Are there any differences in the JavaScript of these two modes in IE 9? If yes, what are they?
问题:
回答1:
IE9 standards document mode supports ECMAScript, Fifth Edition features, so the method such as
forEach
,every
,map
ofArray
anddefineProperty
,keys
ofObject
are support well. more aboutIE9 standards document mode supports enhanced DOM programmability. (may not what you're interested in, but it does so). more about
IE9 removes some of the key differences between IE8 JavaScript implementation and the ECMAScript, Third Edition Specification.
Quirks mode supports the JavaScript functionality of IE6, It is similar to the behavior of IE5 and the Quirks mode behavior of IE6, IE7 and IE8.
Something changed in IE9 Standards Mode, such as does not support
arguments.caller
anymore, JavaScript Property Enumeration Differs, and so on. read Features Changed in Windows Internet Explorer 9 all about this.
回答2:
yes, there are some differences.
for example, in quirks mode, document.body (the body
-element) is the root element and in standard mode it's the html
-element (document.documentElement).
this can have a confusing effect when trying to calculate the viewport dimensions.