Element: getAttributeNodeNS() メソッド

指定された名前空間と名前を持つ属性の Attr ノードを返します。

構文

js
getAttributeNodeNS(namespace, nodeName)

引数

  • namespace は属性の名前空間を特定する文字列です。
  • nodeName は属性の名前を指定する文字列です。

返値

指定された属性のノードです。

メモ

getAttributeNodeNSgetAttributeNode よりも、特定の名前空間に含まれる属性を特定することができる点でより具体的です。対応するセッターメソッドは setAttributeNodeNS です。

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
# dom-element-getattributenodens

ブラウザーの互換性

BCD tables only load in the browser