【问题标题】:DOM Level2 API document.createAttributeNS() undefined in latest chrome version?DOM Level2 API document.createAttributeNS() 在最新的 chrome 版本中未定义?
【发布时间】:2014-05-30 07:13:51
【问题描述】:

我们的一个应用程序使用了文档对象的 createAttributNS、setAttributeNS DOM Level 2 API,这似乎已从最新的 chrome 版本中删除!

有什么解决方法吗?**

【问题讨论】:

标签: javascript html google-chrome dom


【解决方案1】:

将此脚本添加到 chrome 不支持的函数 createAttributeNS 作为 Dom 函数

Document.prototype.createAttributeNS = function(name, ns) {
      var attr = this.createAttribute(name);
      attr.namespaceURI = ns;
      return attr;
}

【讨论】:

  • 我得到了 polyfill。无论如何谢谢。它仅在最新版本中不起作用。
猜你喜欢
  • 1970-01-01
  • 2019-06-02
  • 2021-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-20
  • 1970-01-01
  • 2021-07-09
相关资源
最近更新 更多