Element.removeAttributeNS()
removeAttributeNS()
は Element
インターフェイスのメソッドで、要素から指定された属性を取り除きます。
構文
removeAttributeNS(namespace, attrName)
引数
namespace
は文字列で、属性の名前空間を示します。attrName
は文字列で、現在のノードから取り除く属性の名前を示します。
返値
なし (undefined
)。
例
// Given:
// <div id="div1" xmlns:special="http://www.mozilla.org/ns/specialspace"
// special:specialAlign="utterleft" width="200px" />
d = document.getElementById("div1");
d.removeAttributeNS("http://www.mozilla.org/ns/specialspace", "specialAlign");
// Now: <div id="div1" width="200px" />
メモ
DOM メソッドは要素の属性を取り扱います。
名前空間に無関係、 最も一般的に使用されるメソッド |
名前空間に限定される変数 (DOM Level 2) |
Attr ノードを直接扱う DOM レベル 1 のメソッド(ほとんど使用されない) |
Attr ノードを直接扱う DOM レベル 2 名前空間に限定されるメソッド(ほとんど使用されない) |
---|---|---|---|
setAttribute (DOM 1) |
setAttributeNS |
setAttributeNode |
setAttributeNodeNS |
getAttribute (DOM 1) |
getAttributeNS |
getAttributeNode |
getAttributeNodeNS |
hasAttribute (DOM 2) |
hasAttributeNS |
- | - |
removeAttribute (DOM 1) |
removeAttributeNS |
removeAttributeNode |
- |
仕様書
Specification |
---|
DOM Standard # ref-for-dom-element-removeattributens① |
ブラウザーの互換性
BCD tables only load in the browser
Firefox 3 以降では、このメソッドは DOM 値を既定値にリセットします。