NamedNodeMap.getNamedItemNS()
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.
getNamedItemNS()
は NamedNodeMap
インターフェイスのメソッドで、指定された名前空間の指定されたローカル名に対応する Attr
を返します。対応する属性がない場合は null
を返します。
構文
js
getNamedItemNS(namespace, localName);
引数
返値
引数で与えられた名前空間とローカル名に対応する Attr
です。見つからない場合は null
です。
例
js
const parser = new DOMParser();
const xmlString =
'<warning ob:one="test" xmlns:ob="http://www.example.com/ob">Beware!</warning>';
const doc = parser.parseFromString(xmlString, "application/xml");
const pre = document.getElementsByTagName("pre")[0];
const warning = doc.getElementsByTagName("warning")[0];
const attrMap = warning.attributes;
pre.textContent = `The 'ob:one' attribute contains: ${
attrMap.getNamedItemNS("http://www.example.com/ob", "one").value
}.`;
仕様書
Specification |
---|
DOM # dom-namednodemap-getnameditemns |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
getNamedItemNS |
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.