Document.compatmode
Backcompat: Standard compatibility mode shutdown. Browser width: document.body.clientWidth;
Css1compat: Standard compatibility mode is open. Browser width: document.documentElement.clientWidth.
Copy Code code as follows:
var d = document,
DD = d.documentelement,
db = D.body,
DC = D.compatmode = ' Css1compat ',
DX = DC? dd:db;
Cwidth = Dx.clientwidth;
Cheight = Dx.clientheight;
Swidth = Dx.scrollwidth;
Sheight = Dx.scrollheight;
Sleft = Dx.scrollleft;
STop = Dx.scrolltop;
In Standars mode:
The true width of the element = Margin-left + border-left-width + padding-left + width + padding-right + border-right-width + margin-right;
In quirks mode:
The width is the actual breadth of the element, the content width = width-(margin-left + margin-right + padding-left + padding-right + border-left-width + border-righ T-width)
In JS how to determine the current browser is how to resolve?
The Document object has a property compatmode, which has two values:
Backcompat corresponds to quirks mode
Css1compat corresponds to strict mode
Compatibility table for browsers
Http://www.quirksmode.org/compatibility.html
Historical reasons:
When the early browsers Netscape 4 and explorer 4 parsed the CSS and did not comply with the standards of the consortium, the parsing was called quirks mode, but as the standards of the consortium became more and more important, Many browsers begin to parse CSS according to the standard of the web, and follow the model of the standard for parsing CSS we call strict mode (strict mode)
Firefly