DOM IE 中的 2 级和 3 级核心支持?

DOM Level 2 and 3 Core support in IE?

我刚刚发现一些使用 .setAttributeNode 的旧 javascript 代码已损坏。 Internet Explorer(在 IE10 中测试)给出错误(未知属性),而 FireFox 警告它已被弃用。

RienNeVaPlu͢s 向我指出 DOM 4 级核心已下降 .setAttributeNode along with a bunch of other methods.

的文档

我尝试搜索有关 MS 何时以及为何放弃 DOM 3 级核心兼容性的文档。检查最新补丁后,我认为它与 2015 年 2 月 10 日发布的 MS15-009 补丁有关,但我尚未确认。

任何人都可以确认是否所有 deprecated methods 已被删除,或者是否只是其中的一部分?

以下是可能受影响的方法列表:

接口成员:

节点

    hasAttributes()
    attributes
    namespaceURI
    prefix
    localName
    isSupported
    getFeature()
    getUserData()
    setUserData()
    isSameNode() 

文档

    createCDATASection()
    createAttribute()
    createAttributeNS()
    createEntityReference()
    inputEncoding
    xmlEncoding
    xmlStandalone
    xmlVersion
    strictErrorChecking
    domConfig
    normalizeDocument()
    renameNode() 

DOM实施

    getFeature() 

属性

No longer inherits from Node and therefore completely changed. 

元素

    getAttributeNode()
    getAttributeNodeNS()
    setAttributeNode()
    removeAttributeNode()
    schemaTypeInfo
    setIdAttribute()
    setIdAttributeNS()
    setIdAttributeNode() 

文档类型

    entities
    notations
    internalSubset 

文字

    isElementContentWhitespace
    replaceWholeText() 

更新:

我又测试了一些,发现旧式事件也不起作用。

更新二:

我在 IE10 和 IE11 上测试过,行为是一样的,它们似乎都遵循 DOM 4 级核心。 您可以通过在浏览器中激活兼容模式(模拟 IE7)来恢复到较旧的 DOM 级别,但这也意味着新功能不可用。

似乎所有主流浏览器都在 2015 年初切换到 W3C DOM 4。

为了兼容,您需要在您的网站上使用新的 DOM 结构。

使用 Internet Explorer 浏览的用户可以启用 Compatibility Mode 模拟 IE7 并使用 DOM 3(已在 IE10 和 IE11 上测试)。