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