nodeName

nodeName

nodeName 属性 (DOM 1+ Node 界面)

[1] (ノード) 名を返します。 XML の生成規則で言うと Name になる部分です。

(XML名前空間で言えば QName の部分です。但し DOM では XML 名前空間でない文書も扱えますから、 QName として適当な値が得られるかは分かりません。)

この属性は DOM 1+ です。 (DOM 2 以上では、名前空間に対応した localName, namespaceURI, prefix を使ったほうが良いでしょう。)

この属性は読取専用です。得られる値は DOMString 型です。

[2] 節の種類と得られる値:

界面nodeName
Attr属性値
CDATASection#cdata-section
Comment#comment
Document#document
DocumentFragment#document-fragment
DocumentType文書要素名
Element要素型名
Entity実体名
EntityReference被参照実体名
Notation記法名
ProcessingInstruction対象名
Text#text

仕様書:

メモ

[3] Fix #171: Add Attr#nodeName as an alias for name · whatwg/dom@90427aa ( 版) <https://github.com/whatwg/dom/commit/90427aa0aa267da88937fc83fb9023eb99f4dbcd>

[4] Make Attr inherit from Node again (annevk著, ) <https://github.com/whatwg/dom/commit/625a0747f137454c155a7b577a9e45be1aa35a34>

[5] Define nodeName as "#cdata-section" for CDATASection nodes (foolip著, ) <https://github.com/whatwg/dom/commit/67a7550d757b4194a8248b336944292586fdc117>

[6] Stop defining nodeName in terms of tagName (annevk著, ) <https://github.com/whatwg/dom/commit/8e754b524b277b186503ed53d135b647b02d772b>

[7] Stop defining nodeName in terms of tagName · Issue #297 · whatwg/dom () <https://github.com/whatwg/dom/issues/297>

[8] Stop defining nodeName in terms of tagName by annevk · Pull Request #593 · whatwg/dom () <https://github.com/whatwg/dom/pull/593>