属性

内容属性 (DOM)

[51] 属性 (ぞくせい) (attribute) は、 要素に関する付加情報を記述するものです。

[52] 属性は、属性名属性値の組です。要素にはいくつでも属性を指定できますが、 同じ属性名のものは1つしか指定できません。 つまり要素属性リスト要素ごとの写像と捉えることができます。

[53] 具体的にどのような属性名属性値を指定できるのかは、要素種類や文脈によって異なります。

仕様書

意味

[40] 著者は、属性属性値を、その想定用途以外の目的で使ってはなりません >>39。これは、文書を正しく処理できるようにするための要件です >>39

文脈

[38] 著者は、属性属性値を、適用可能な仕様書で認められていないのに使ってはなりません >>39。 これは、言語の将来の拡張の余地を残すためです >>39

[42] どのような属性を使って良いかは、要素ごとに決められています。

要素の項を参照。

[43] いくつかの属性は、多数の要素で共通して使うことができます。 そうした属性を、次のように分類しています。

[44] なお、同じ属性名であっても、要素によって異なる意味を持つことがあります。

[45] ほとんどの要素は、特定の属性のみを認め、それ以外を禁止しています。 例外的に、次の要素は、 (一定の制約の元で) 著者が任意の名前属性を使うことを認めています。

この他に、 data-* 属性を多くの要素で使えます。

Attr インターフェイス (DOM)

[13] DOM1属性節 (Attr node) が持つことが出来る子の種類は、 TextEntityReference の2種類です。

[14] DOM の文書木・節モデルの中では、属性はやや特殊な位置づけになっています。

[15] Node を継承して、

読取専用属性name名前[DOM1]
読取専用属性specified指定されているか[DOM1]
属性value[DOM1]
読取専用属性ownerElement親要素節[DOM2]

[16] Attr 節点の子孫である EntityReference 節点の子供は EntityReference または Text しか認められない・・・はずですが、 DOM の仕様書にはそんなこと一言も書いてないな。

[17] DOM の仕様書には Attr は他の種類の Node とは違って Element と切り離せないものだとかなんとか説明がありますが、 それでいてなぜか Attr が単独で存在できたりします。 それ自体は値を持たずに子孫がいたり。

[18]

Interface AttrExtended
  IDL Definition
    attribute boolean type;
  Attributes
    isClassAttribute of type boolean
      Whether the attribute is a class attribute or not.
      If it is a class attribute, the value is "true"; otherwise, "false".
      Note that not all attributes whose local name is "class"
      is a class attribute.

[19] ChromeDOM3 の規定通り Attr子供Text が来る構造になっていて、通常の Node として操作できます。 しかし WinIEGeckoDOM4 の規定のように Attr の値を節点としては扱っていません。 childNodes は空ですし、 appendChildHierarchyRequestError になります。

[20] IRC logs: freenode / #whatwg / 20121213 ( ( 版)) http://krijnhoetmer.nl/irc-logs/whatwg/20121213#l-339

[21] Re: [DOMCore] Attr ( (Jonas Sicking 著, 版)) http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/0797.html

[22] Attr - Document Object Model (DOM) | MDN ( ( 版)) https://developer.mozilla.org/en/docs/DOM/Attr

属性の変化

[36] 要素属性が変化した時の要素属性依存の動作を記述するためのフックが DOM Standard属性変更手順群 (attribute change steps) として定義されています。 >>11

[37] 次のものに関する属性変更手順群が定義されています。

[29] 仕様書上ではこのフックを使っていませんが、属性が変化した時に次のような処理が連動して行われます。

[46] カスタム要素反応に関する処理は、仕様書上は属性変更手順群ではなく、 属性変更手順群の直前に実行する処理として規定されています。

[41] レンダリングの更新も参照。

[23] かつては DOM Standard で4つのフックが定義されていました >>11。 その後属性変更手順群に統一されました。

[28] 設定は追加・変更のどちらかと同時に起こります。

[8] かつては次の内容属性にも処理が規定されていました。

歴史

属性 (SGML)

[1]

(141) (要素の) 属性 [attribute (of an element)]
及び内容を除く特質JIS X 4151‐1992 3.

[2] SGML では要素型要素内容も広い意味では属性に含まれます JIS X 4151‐1992 参考SGML 規格本体で特に 要素の属性として定義されているものはそれ以外、 すなわち属性指定で指定され得る形式的な属性のみを指すべく >>1 のように説明されています。

属性 (XML)

[3]

属性 (attribute)
属性は DTD で宣言される要素引数です。 属性値域、更に場合によっては既定値DTD で定義されます。

仕様書:

[7] IRC logs: freenode / #whatwg / 20090925 ( 版) http://krijnhoetmer.nl/irc-logs/whatwg/20090925#l-298

属性節点 (XPath 1.0 データモデル) / attribute:: (@) 軸 (XPath 1.0)

XXX

[30] Chrome でも Firefox でも、仕様通り xmlns 名前空間属性XPath データモデル上の属性節点としては存在しません。

属性情報項目 (XML 情報項目)

[6] AtomAtomPub の仕様書では、「属性」は属性情報項目を意味します。

[31] Touch Events ( ( 版)) https://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html#webidl-conform

[32] Re: Moving Touch Events v1 to Recommendation ( (Doug Schepers 著, 版)) http://lists.w3.org/Archives/Public/public-webevents/2013OctDec/0000.html

[33] Accessible Rich Internet Applications (WAI-ARIA) 1.0 ( ( 版)) http://www.w3.org/WAI/PF/aria/complete#def_attribute

[34] XQuery and XPath Data Model 3.0 ( ( 版)) http://www.w3.org/TR/xpath-datamodel-3/#AttributeNode

[35] Bug 25460 – muted and mediagroup should not be special-cased for the parser ( ( 版)) https://www.w3.org/Bugs/Public/show_bug.cgi?id=25460

[9] OPDS Catalog 1.1 ( 版) http://opds-spec.org/specs/opds-catalog-1-1-20110627/

The Infoset terms "Element Information Item" and "Attribute Information Item" are shortened to "element" and "attribute" respectively. Therefore, when this specification uses the term "element", it is referring to an Element Information Item, and when it uses the term "attribute", it is referring to an Attribute Information Item.

[10] Fix #489: 'src attribute is missing' is equal to 'no src attribute sp… · whatwg/html@3f7fda0 ( 版) https://github.com/whatwg/html/commit/3f7fda0be2759dc36480c8acc037d149ee831aea

[12] Use a single concept for attribute changes · whatwg/dom@4b291d1 ( 版) https://github.com/whatwg/dom/commit/4b291d1a91a1e8b59997d4b021137d809706bd37

[47] Integrate with the Referrer Policy spec, part 1 of n ( (domenic著, )) https://github.com/whatwg/html/commit/6a7318072f340ad45229df171245d70d8621c2fe

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

[49] ATTRIBUTE_NODE and SHOW_ATTRIBUTE are no longer historical (foolip著, ) https://github.com/whatwg/dom/commit/dc3990d2678375a17fa05f3f4de99da23077c229

[50] Further Attr node fixes for compareDocumentPosition() (annevk著, ) https://github.com/whatwg/dom/commit/0e17e05b7b0273799b853c4782b2eac9a88fdea1

[54] Elements with duplicated attributes are not nonceable. (mikewest著, ) https://github.com/w3c/webappsec-csp/commit/649393514b9aaf9277bfd21ee1834f4befd029be

[55] Consider hiding `nonce` content attributes. · Issue #2369 · whatwg/html () https://github.com/whatwg/html/issues/2369

[56] [CITE@”ja”[【論調比較・サマータイム】日経はシステム改修の問題を詳報 | News Socra (ニュース ソクラ)]] () https://socra.net/society/%E3%80%90%E8%AB%96%E8%AA%BF%E6%AF%94%E8%BC%83%E3%83%BB%E3%82%B5%E3%83%9E%E3%83%BC%E3%82%BF%E3%82%A4%E3%83%A0%E3%80%91%E6%97%A5%E7%B5%8C%E3%81%AF%E3%82%B7%E3%82%B9%E3%83%86%E3%83%A0%E6%94%B9%E4%BF%AE/

<html lang=”ja”>

[57] Editorial: Clarify that attributes and operations may be namespace me… (littledan著, ) https://github.com/heycam/webidl/commit/6b9ad923b1c2ce7d128790dfceb4dda33adb9c89

[58] Editorial: embrace that attributes are objects (annevk, , ) https://github.com/whatwg/dom/commit/0038d097f5cad2a7ffdbe75c234b58960aa320f6

[59] Editorial: embrace that attributes are objects by annevk · Pull Request #805 · whatwg/dom () https://github.com/whatwg/dom/pull/805