Does the Document TYPE ( or even the way HTML tag is written) affects the javascript engine in IE9?
Does the Document TYPE ( or even the way HTML tag is written) affects the javascript engine in IE9? I am not ta开发者_Python百科lking about the rendition but the behavior other than it.
Yes. The <!doctype>
is used as rendering mode switch. This is notable especially in Internet Explorer, because this browser maintains (almost) full backwards compatibility in quirks mode, so there's no getElementsByClassName
, Element Traversal, addEventListener
, Selection API, ES5 support and many many other things. ES5 support also means changes in parsing so you might experience differences in things not related to DOM.
Always use <!doctype html>
at the top of your markup, it's simple and provides best cross-browser compatibility.
Not exactly, but there are some differences in DOM support between standards and quirks mode. (e.g. in standards mode the browser does not brokenly support name as id).
精彩评论