开发者

typeof document['domConfig'] thows an error in Firefox

开发者 https://www.devze.com 2023-02-19 09:47 出处:网络
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 l

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消