NamedNodeMap.removeNamedItemNS()
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.
removedNamedItemNS()
は NamedNodeMap
インターフェイスのメソッドで、指定された名前空間とローカル名に対応する Attr
をこのマップから取り除きます。
構文
js
removeNamedItem(namespace, localName);
引数
返値
取り除かれた Attr
です。
例外
NotFoundError
DOMException
-
指定された名前空間とローカル名の属性がなかった場合に発生します。
例
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;
let result = `The 'ob:one' attribute initially contains '${attrMap["ob:one"].value}'.\n`;
result += "We remove it.\n\n";
attrMap.removeNamedItemNS("http://www.example.com/ob", "one");
if (attrMap["ob:one"]) {
result += "And 'ob:one' still exists.";
} else {
result += "And 'ob:one' is no more to be found.";
}
pre.textContent = result;
仕様書
Specification |
---|
DOM # dom-namednodemap-removenameditemns |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
removeNamedItemNS |
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.