Element:getAttributeNodeNS() 方法
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Element
实例的 getAttributeNodeNS()
方法返回元素的指定命名空间的 Attr
节点。
如果你需要限定命名空间的属性的实例属性,此方法会很有用。如果你只需要限定命名空间的属性的值,你可以改用 getAttributeNS()
方法。
如果你需要 HTML 文档中的元素的 Attr
节点,并且属性没有限定命名空间,那么可以改用 getAttributeNode()
方法。
语法
js
getAttributeNodeNS(namespace, nodeName)
参数
namespace
:指定属性的命名空间的字符串。nodeName
:指定属性名称的字符串。
返回值
指定属性的节点。
备注
getAttributeNodeNS
相比 getAttributeNode 更加具体,因为它允许你指定属于特定命名空间的属性。对应的 setter 方法是 setAttributeNodeNS。
规范
Specification |
---|
DOM # dom-element-getattributenodens |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
getAttributeNodeNS |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.