DOM

Attr.specified プロパティ

 編集:2022.10.31 by T.A.

[Edge]。読取専用 非推奨。→

非推奨:この機能は推奨されなくなりました。一部のブラウザは引き続きサポートしている場合がありますが、関連するWeb標準からすでに削除されているか、削除中の場合、または互換性の目的でのみ保持されている場合があります。使用を避け、可能であれば既存のコードを更新してください。このページの下部にある互換性の表を参照して、決定を下してください。この機能はいつでも機能しなくなる可能性があることに注意してください。

常にtrueを返します。

旧mdn: かつては、ソースコードやスクリプトで明示的に指定された場合に true を返し、ドキュメントの DTD で定義されたデフォルト値である場合に false を返しました。

構文
Attr.specified
Attr Attr

true。

HTML:

<SPAN id=IdTest lang="en-US">SPAN.Element</SPAN>

JavaScript:

D=IdTest.attributes[0];  //=[object]:[object Attr]
	//namespaceURI=[object]:null
	//prefix=[object]:null
	//localName=[string]:id
	//name=[string]:id
	//value=[string]:IdTest
	//ownerElement=[object]:[object HTMLSpanElement]
	//specified=[boolean]:true
	//nodeType=[number]:2
	//nodeName=[string]:id
	//…
D=IdTest.attributes[1];  //=[object]:[object Attr]
	//namespaceURI=[object]:null
	//prefix=[object]:null
	//localName=[string]:lang
	//name=[string]:lang
	//value=[string]:en-US
	//ownerElement=[object]:[object HTMLSpanElement]
	//specified=[boolean]:true
	//nodeType=[number]:2
	//nodeName=[string]:lang
	//…

attributes


テスト