这篇翻译不完整。请帮忙从英语翻译这篇文章

概要

通过命名空间 URI 和名称来获取属性节点。

语法

attributeNode = element.getAttributeNodeNS(namespace,nodeName) 
  • attributeNode 获取的属性节点.
  • namespace 命名空间字符串
  • nodeName 属性节点的名称.

== Example == TBD The example needs to be fixed pre> // html: <div id="top" /> t = document.getElementById("top"); specialNode = t.getAttributeNodeNS( "http://www.mozilla.org/ns/specialspace", "id"); // iNode.value = "full-top" </pre

笔记

getAttributeNodeNS 相比 getAttributeNode 更加具体,允许你在特定的命名空间里获取属性. 对应的 setter 方法是 setAttributeNodeNS.

DOM methods dealing with element's attributes:

Not namespace-aware, most commonly used methods Namespace-aware variants (DOM Level 2) DOM Level 1 methods for dealing with Attr nodes directly (seldom used) DOM Level 2 namespace-aware methods for dealing with Attr nodes directly (seldom used)
setAttribute (DOM 1) setAttributeNS setAttributeNode setAttributeNodeNS
getAttribute (DOM 1) getAttributeNS getAttributeNode getAttributeNodeNS
hasAttribute (DOM 2) hasAttributeNS - -
removeAttribute (DOM 1) removeAttributeNS removeAttributeNode -

规格

DOM Level 2 Core: getAttributeNodeNS

文档标签和贡献者

标签: 
此页面的贡献者: anderlaw
最后编辑者: anderlaw,