Why does this expression:
typeof document['domConfig']
throw an error in Firefox (4)?
All the other browsers (IE9, Chrome 10, Safari 5, Opera 11) do not throw an error on tha开发者_开发知识库t line!
Live demo: http://jsfiddle.net/TvBeT/
Btw, document.domConfig
is a property defined in the DOM Core spec.
None of the other browser define document.domConfig, so they return undefined.
More interesting, firefox 4 is the only browser that can run document.normalizeDocument(), which method gives domConfig a value while it is running, merging adjacent text-nodes and adjusting the containment of bad html tags on an existing or newly created Document..
From the MDN page on domConfig
:
This feature has been removed from the Web. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
精彩评论