Introduction to the Css1compat use of Document.compatmode

Source: Internet
Author: User

  This article mainly introduces the use of Document.compatmode Css1compat, need friends can refer to the following

document.compatmode    BACKCOMPAT: Standard compatibility mode shutdown. Browser width:document.body.clientwidth;    css1compat: Standard compatibility mode is open. Browser width: document.documentElement.clientWidth.   Code as follows: var d = document,  dd = d.documentelement,  db = d.body,  DC = D.compatmode = = ' Css1comp At ',  dx = DC? dd:db;    Cwidth = dx.clientwidth;    Cheight = dx.clientheight;    Swidth = dx.scrollwidth ;    Sheight = dx.scrollheight;    Sleft = dx.scrollleft;    STop = dx.scrolltop;  &nbs P   in standars mode:    element true width = margin-left + border-left-width + padding-left + width + padding-right + bo Rder-right-width + margin-right;    in quirks mode:    width is the actual width of the element, the width of the content = width-(margin-left + Mar Gin-right + padding-left + padding-right + border-left-width + border-right-width)     How do you determine how the current browser is being parsed in JS?   Document object has an attribute Compatmode, which has two values:    Backcompat corresponding quirks Mode&nbsP Css1compat corresponds to strict mode      browser compatibility table     http://www.quirksmode.org/compatibility.html    Historical reasons:    when the early browsers Netscape 4 and explorer 4 did not comply with the standards of the consortium when parsing CSS, the parsing is what we call quirks mode (weird mode), But as the standards of the consortium become more and more important, many browsers begin to parse CSS according to the standards of the consortium, and follow the standard of the web to parse the CSS model we call strict mode (strict mode)   firefly 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.