Skip to content

Commit 0038d09

Browse files
authored
Editorial: embrace that attributes are objects
Closes #801. (Also closes #802 and closes #807.)
1 parent c825cea commit 0038d09

File tree

1 file changed

+68
-113
lines changed

1 file changed

+68
-113
lines changed

dom.bs

Lines changed: 68 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ urlPrefix: https://tc39.github.io/ecma262/#; spec: ECMASCRIPT
3333
type: dfn
3434
text: Realm; url: realm
3535
text: surrounding agent; url: surrounding-agent
36-
urlPrefix: https://w3c.github.io/hr-time/#; spec: HR-TIME-2
36+
urlPrefix: https://w3c.github.io/hr-time/#; spec: HR-TIME
3737
type:typedef; urlPrefix: dom-; text: DOMHighResTimeStamp
3838
type:dfn; text: time origin; url: dfn-time-origin
3939
type:dfn; text: clock resolution
@@ -967,7 +967,7 @@ correct defaults.</p>
967967

968968
<p class=warning>User agents should set a minimum resolution of <var>event</var>'s
969969
{{Event/timeStamp}} attribute to 5 microseconds following the existing <a>clock resolution</a>
970-
recommendation. [[!HR-TIME-2]]
970+
recommendation. [[!HR-TIME]]
971971

972972
<li><p><a for=map>For each</a> <var>member</var><var>value</var> in <var>dictionary</var>, if
973973
<var>event</var> has an attribute whose <a spec=webidl>identifier</a> is <var>member</var>, then
@@ -3591,11 +3591,6 @@ run these steps:
35913591
<var>target</var> with null, null, null, <var>addedNodes</var>, <var>removedNodes</var>,
35923592
<var>previousSibling</var>, and <var>nextSibling</var>.
35933593

3594-
<p>To <dfn noexport>queue an attribute mutation record</dfn> for <var>target</var> with
3595-
<var>name</var>, <var>namespace</var>, and <var>oldValue</var>, <a>queue a mutation record</a> of
3596-
"<code>attributes</code>" for <var>target</var> with <var>name</var>, <var>namespace</var>,
3597-
<var>oldValue</var>, « », « », null, and null.
3598-
35993594

36003595
<h4 id=interface-mutationrecord>Interface {{MutationRecord}}</h4>
36013596

@@ -6101,118 +6096,87 @@ its <a for=Element>attribute list</a> <a for=list>is empty</a>.
61016096
<dfn export id=concept-element-attribute-has lt="has an attribute">has</dfn> an <a>attribute</a>
61026097
<var>A</var> if its <a for=Element>attribute list</a> <a for=list>contains</a> <var>A</var>.
61036098

6104-
This and <a lt="other applicable specifications">other specifications</a> may define
6099+
<p>This and <a lt="other applicable specifications">other specifications</a> may define
61056100
<dfn export id=concept-element-attributes-change-ext>attribute change steps</dfn> for
61066101
<a for=/>elements</a>. The algorithm is passed <var>element</var>, <var>localName</var>,
61076102
<var>oldValue</var>, <var>value</var>, and <var>namespace</var>.
61086103

6109-
To <dfn export id=concept-element-attributes-change lt="change an attribute">change</dfn> an
6110-
<a>attribute</a> <var>attribute</var>
6111-
from an <a for="/">element</a> <var>element</var>
6112-
to <var>value</var>, run these steps:
6104+
<p>To <dfn noexport>handle attribute changes</dfn> for an <a>attribute</a> <var>attribute</var> with
6105+
<var>element</var>, <var>oldValue</var>, and <var>newValue</var>, run these steps:
61136106

61146107
<ol>
6115-
<li><p><a>Queue an attribute mutation record</a> for <var>element</var> with <var>attribute</var>'s
6116-
<a for=Attr>local name</a>, <var>attribute</var>'s <a for=Attr>namespace</a>, and
6117-
<var>attribute</var>'s <a for=Attr>value</a>.
6108+
<li><p><a>Queue a mutation record</a> of "<code>attributes</code>" for <var>element</var> with
6109+
<var>attribute</var>'s <a for=Attr>local name</a>, <var>attribute</var>'s
6110+
<a for=Attr>namespace</a>, <var>oldValue</var>, « », « », null, and null.
61186111

6119-
<li>If <var>element</var> is <a for=Element>custom</a>, then
6112+
<li><p>If <var>element</var> is <a for=Element>custom</a>, then
61206113
<a>enqueue a custom element callback reaction</a> with <var>element</var>, callback name
61216114
"<code>attributeChangedCallback</code>", and an argument list containing <var>attribute</var>'s
6122-
<a for=Attr>local name</a>, <var>attribute</var>'s <a for=Attr>value</a>, <var>value</var>, and
6123-
<var>attribute</var>'s <a for=Attr>namespace</a>.
6115+
<a for=Attr>local name</a>, <var>oldValue</var>, <var>newValue</var>, and <var>attribute</var>'s
6116+
<a for=Attr>namespace</a>.
61246117

61256118
<li><p>Run the <a>attribute change steps</a> with <var>element</var>, <var>attribute</var>'s
6126-
<a for=Attr>local name</a>, <var>attribute</var>'s <a for=Attr>value</a>, <var>value</var>, and
6127-
<var>attribute</var>'s <a for=Attr>namespace</a>.
6128-
6129-
<li>Set <var>attribute</var>'s
6130-
<a for=Attr>value</a> to <var>value</var>.
6119+
<a for=Attr>local name</a>, <var>oldValue</var>, <var>newValue</var>, and <var>attribute</var>'s
6120+
<a for=Attr>namespace</a>.
61316121
</ol>
61326122

6133-
To <dfn export id=concept-element-attributes-append lt="append an attribute">append</dfn> an
6134-
<a>attribute</a> <var>attribute</var> to
6135-
an <a for="/">element</a> <var>element</var>,
6136-
run these steps:
6123+
<p>To <dfn export id=concept-element-attributes-change lt="change an attribute">change</dfn> an
6124+
<a>attribute</a> <var>attribute</var> to <var>value</var>, run these steps:
61376125

61386126
<ol>
6139-
<li><p><a>Queue an attribute mutation record</a> for <var>element</var> with <var>attribute</var>'s
6140-
<a for=Attr>local name</a>, <var>attribute</var>'s <a for=Attr>namespace</a>, and null.
6127+
<li><p><a>Handle attribute changes</a> for <var>attribute</var> with <var>attribute</var>'s
6128+
<a for=Attr>element</a>, <var>attribute</var>'s <a for=Attr>value</a>, and <var>value</var>.
61416129

6142-
<li>If <var>element</var> is <a for=Element>custom</a>, then
6143-
<a>enqueue a custom element callback reaction</a> with <var>element</var>, callback name
6144-
"<code>attributeChangedCallback</code>", and an argument list containing <var>attribute</var>'s
6145-
<a for=Attr>local name</a>, null, <var>attribute</var>'s <a for=Attr>value</a>, and
6146-
<var>attribute</var>'s <a for=Attr>namespace</a>.
6130+
<li><p>Set <var>attribute</var>'s <a for=Attr>value</a> to <var>value</var>.
6131+
</ol>
61476132

6148-
<li><p>Run the <a>attribute change steps</a> with <var>element</var>, <var>attribute</var>'s
6149-
<a for=Attr>local name</a>, null, <var>attribute</var>'s <a for=Attr>value</a>, and
6150-
<var>attribute</var>'s <a for=Attr>namespace</a>.
6133+
<p>To <dfn export id=concept-element-attributes-append lt="append an attribute">append</dfn> an
6134+
<a>attribute</a> <var>attribute</var> to an <a for="/">element</a> <var>element</var>, run these
6135+
steps:
6136+
6137+
<ol>
6138+
<li><p><a>Handle attribute changes</a> for <var>attribute</var> with <var>element</var>, null, and
6139+
<var>attribute</var>'s <a for=Attr>value</a>.
61516140

6152-
<li><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
6141+
<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
61536142
<a for=Element>attribute list</a>.
61546143

6155-
<li>Set <var>attribute</var>'s
6156-
<a for=Attr>element</a> to <var>element</var>.
6144+
<li><p>Set <var>attribute</var>'s <a for=Attr>element</a> to <var>element</var>.
61576145
</ol>
61586146

6159-
To <dfn export id=concept-element-attributes-remove lt="remove an attribute">remove</dfn> an
6160-
<a>attribute</a> <var>attribute</var>
6161-
from an <a for="/">element</a> <var>element</var>,
6162-
run these steps:
6147+
<p>To <dfn export id=concept-element-attributes-remove lt="remove an attribute">remove</dfn> an
6148+
<a>attribute</a> <var>attribute</var>, run these steps:
61636149

61646150
<ol>
6165-
<li><p><a>Queue an attribute mutation record</a> for <var>element</var> with <var>attribute</var>'s
6166-
<a for=Attr>local name</a>, <var>attribute</var>'s <a for=Attr>namespace</a>, and
6167-
<var>attribute</var>'s <a for=Attr>value</a>.
6168-
6169-
<li>If <var>element</var> is <a for=Element>custom</a>, then
6170-
<a>enqueue a custom element callback reaction</a> with <var>element</var>, callback name
6171-
"<code>attributeChangedCallback</code>", and an argument list containing <var>attribute</var>'s
6172-
<a for=Attr>local name</a>, <var>attribute</var>'s <a for=Attr>value</a>, null, and
6173-
<var>attribute</var>'s <a for=Attr>namespace</a>.
6151+
<li><p><a>Handle attribute changes</a> for <var>attribute</var> with <var>attribute</var>'s
6152+
<a for=Attr>element</a>, <var>attribute</var>'s <a for=Attr>value</a>, and null.
61746153

6175-
<li><p>Run the <a>attribute change steps</a> with <var>element</var>, <var>attribute</var>'s
6176-
<a for=Attr>local name</a>, <var>attribute</var>'s <a for=Attr>value</a>, null, and
6177-
<var>attribute</var>'s <a for=Attr>namespace</a>.
6154+
<li><a for=list>Remove</a> <var>attribute</var> from <var>attribute</var>'s
6155+
<a for=Attr>element</a>'s <a for=Element>attribute list</a>.
61786156

6179-
<li><a for=list>Remove</a> <var>attribute</var> from <var>element</var>'s
6180-
<a for=Element>attribute list</a>.
6181-
6182-
<li>Set <var>attribute</var>'s
6183-
<a for=Attr>element</a> to null.
6157+
<li><p>Set <var>attribute</var>'s <a for=Attr>element</a> to null.
61846158
</ol>
61856159

6186-
To <dfn export id=concept-element-attributes-replace lt="replace an attribute">replace</dfn> an
6187-
<a>attribute</a> <var>oldAttr</var> by an <a>attribute</a> <var>newAttr</var>
6188-
in an <a for="/">element</a> <var>element</var>, run these steps:
6160+
<p>To <dfn export id=concept-element-attributes-replace lt="replace an attribute">replace</dfn> an
6161+
<a>attribute</a> <var>oldAttr</var> with an <a>attribute</a> <var>newAttr</var>, run these steps:
61896162

61906163
<ol>
6191-
<li><p><a>Queue an attribute mutation record</a> for <var>element</var> with <var>oldAttr</var>'s
6192-
<a for=Attr>local name</a>, <var>oldAttr</var>'s <a for=Attr>namespace</a>, and
6193-
<var>oldAttr</var>'s <a for=Attr>value</a>.
6164+
<li><p><a>Handle attribute changes</a> for <var>oldAttr</var> with <var>oldAttr</var>'s
6165+
<a for=Attr>element</a>, <var>oldAttr</var>'s <a for=Attr>value</a>, and <var>newAttr</var>'s
6166+
<a for=Attr>value</a>.
61946167

6195-
<li>If <var>element</var> is <a for=Element>custom</a>, then
6196-
<a>enqueue a custom element callback reaction</a> with <var>element</var>, callback name
6197-
"<code>attributeChangedCallback</code>", and an argument list containing <var>oldAttr</var>'s
6198-
<a for=Attr>local name</a>, <var>oldAttr</var>'s <a for=Attr>value</a>, <var>newAttr</var>'s
6199-
<a for=Attr>value</a>, and <var>oldAttr</var>'s <a for=Attr>namespace</a>.
6168+
<li><p><a for=list>Replace</a> <var>oldAttr</var> by <var>newAttr</var> in <var>oldAttr</var>'s
6169+
<a for=Attr>element</a>'s <a for=Element>attribute list</a>.
62006170

6201-
<li><p>Run the <a>attribute change steps</a> with <var>element</var>, <var>oldAttr</var>'s
6202-
<a for=Attr>local name</a>, <var>oldAttr</var>'s <a for=Attr>value</a>, <var>newAttr</var>'s
6203-
<a for=Attr>value</a>, and <var>oldAttr</var>'s <a for=Attr>namespace</a>.
6204-
6205-
<li><p><a for=list>Replace</a> <var>oldAttr</var> by <var>newAttr</var> in <var>element</var>'s
6206-
<a for=Element>attribute list</a>.
6171+
<li><p>Set <var>newAttr</var>'s <a for=Attr>element</a> to <var>oldAttr</var>'s
6172+
<a for=Attr>element</a>.
62076173

62086174
<li><p>Set <var>oldAttr</var>'s <a for=Attr>element</a> to null.
6209-
6210-
<li><p>Set <var>newAttr</var>'s <a for=Attr>element</a> to <var>element</var>.
62116175
</ol>
62126176

62136177
<hr>
62146178

6215-
To <dfn export id=concept-element-attributes-get-by-name>get an attribute by name</dfn> given a
6179+
<p>To <dfn export id=concept-element-attributes-get-by-name>get an attribute by name</dfn> given a
62166180
<var>qualifiedName</var> and <a for="/">element</a> <var>element</var>, run these steps:
62176181

62186182
<ol>
@@ -6224,7 +6188,7 @@ To <dfn export id=concept-element-attributes-get-by-name>get an attribute by nam
62246188
whose <a for=Attr>qualified name</a> is <var>qualifiedName</var>, and null otherwise.
62256189
</ol>
62266190

6227-
To
6191+
<p>To
62286192
<dfn export id=concept-element-attributes-get-by-namespace>get an attribute by namespace and local name</dfn>
62296193
given a <var>namespace</var>, <var>localName</var>, and <a for="/">element</a> <var>element</var>,
62306194
run these steps:
@@ -6254,7 +6218,7 @@ run these steps:
62546218
<li><p>Return <var>attr</var>'s <a for=Attr>value</a>.</p></li>
62556219
</ol>
62566220

6257-
To <dfn export id=concept-element-attributes-set>set an attribute</dfn> given an
6221+
<p>To <dfn export id=concept-element-attributes-set>set an attribute</dfn> given an
62586222
<var>attr</var> and <var>element</var>, run these steps:
62596223

62606224
<ol>
@@ -6268,18 +6232,17 @@ To <dfn export id=concept-element-attributes-set>set an attribute</dfn> given an
62686232

62696233
<li><p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
62706234

6271-
<li><p>If <var>oldAttr</var> is non-null, <a lt="replace an attribute">replace</a> it
6272-
by <var>attr</var> in <var>element</var>.
6235+
<li><p>If <var>oldAttr</var> is non-null, then <a lt="replace an attribute">replace</a>
6236+
<var>oldAttr</var> with <var>attr</var>.
62736237

62746238
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>.
62756239

62766240
<li><p>Return <var>oldAttr</var>.
62776241
</ol>
62786242

6279-
To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> for
6280-
an <a for="/">element</a> <var>element</var>
6281-
using a <var>localName</var> and <var>value</var>, and an optional <var>prefix</var>, and
6282-
<var>namespace</var>, run these steps:
6243+
<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> for an
6244+
<a for="/">element</a> <var>element</var>, using a <var>localName</var> and <var>value</var>, and an
6245+
optional <var>prefix</var>, and <var>namespace</var>, run these steps:
62836246

62846247
<ol>
62856248
<li>If <var>prefix</var> is not given, set it to null.
@@ -6297,46 +6260,40 @@ using a <var>localName</var> and <var>value</var>, and an optional <var>prefix</
62976260
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var>, and then
62986261
return.
62996262

6300-
<li><a lt="change an attribute">Change</a>
6301-
<var>attribute</var> from <var>element</var> to
6302-
<var>value</var>.
6263+
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
63036264
</ol>
63046265

6305-
To
6306-
<dfn export id=concept-element-attributes-remove-by-name>remove an attribute by name</dfn>
6266+
<p>To <dfn export id=concept-element-attributes-remove-by-name>remove an attribute by name</dfn>
63076267
given a <var>qualifiedName</var> and <a for="/">element</a> <var>element</var>, run these steps:
63086268

63096269
<ol>
63106270
<li><p>Let <var>attr</var> be the result of
6311-
<a lt="get an attribute by name">getting an attribute</a> given
6312-
<var>qualifiedName</var> and <var>element</var>.
6313-
6314-
<li><p>If <var>attr</var> is non-null, <a lt="remove an attribute">remove</a> it from
6271+
<a lt="get an attribute by name">getting an attribute</a> given <var>qualifiedName</var> and
63156272
<var>element</var>.
63166273

6274+
<li><p>If <var>attr</var> is non-null, then <a lt="remove an attribute">remove</a> <var>attr</var>.
6275+
63176276
<li><p>Return <var>attr</var>.
63186277
</ol>
63196278

6320-
To
6279+
<p>To
63216280
<dfn export id=concept-element-attributes-remove-by-namespace>remove an attribute by namespace and local name</dfn>
6322-
given a <var>namespace</var>, <var>localName</var>, and
6323-
<a for="/">element</a> <var>element</var>, run these steps:
6281+
given a <var>namespace</var>, <var>localName</var>, and <a for="/">element</a> <var>element</var>,
6282+
run these steps:
63246283

63256284
<ol>
6326-
<li>Let <var>attr</var> be the result of
6285+
<li><p>Let <var>attr</var> be the result of
63276286
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
63286287
<var>namespace</var>, <var>localName</var>, and <var>element</var>.
63296288

6330-
<li>If <var>attr</var> is non-null,
6331-
<a lt="remove an attribute">remove</a> it from
6332-
<var>element</var>.
6289+
<li><p>If <var>attr</var> is non-null, then <a lt="remove an attribute">remove</a> <var>attr</var>.
63336290

6334-
<li>Return <var>attr</var>.
6291+
<li><p>Return <var>attr</var>.
63356292
</ol>
63366293

63376294
<hr>
63386295

6339-
An <a for=/>element</a> can have an associated
6296+
<p>An <a for=/>element</a> can have an associated
63406297
<dfn export for=Element id=concept-id lt="ID">unique identifier (ID)</dfn>
63416298

63426299
<p class=note>Historically <a for="/">elements</a> could have multiple identifiers e.g., by using
@@ -6569,8 +6526,7 @@ method, when invoked, must run these steps:
65696526
<a for=Node>node document</a>, then <a lt="append an attribute">append</a> this <a>attribute</a> to
65706527
<a>context object</a>, and then return.
65716528

6572-
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> from <a>context object</a> to
6573-
<var>value</var>.
6529+
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
65746530
</ol>
65756531

65766532
<p>The
@@ -6686,7 +6642,7 @@ when invoked, must run these steps:
66866642
<a for=list>contain</a> <var>attr</var>, then <a>throw</a> a "{{NotFoundError!!exception}}"
66876643
{{DOMException}}.
66886644

6689-
<li><p><a lt="remove an attribute">Remove</a> <var>attr</var> from <a>context object</a>.
6645+
<li><p><a lt="remove an attribute">Remove</a> <var>attr</var>.
66906646

66916647
<li><p>Return <var>attr</var>.
66926648
</ol>
@@ -7098,11 +7054,10 @@ null.
70987054
string <var>value</var>, run these steps:
70997055

71007056
<ol>
7101-
<li>If <var>attribute</var>'s <a for=Attr>element</a> is null, then set <var>attribute</var>'s
7057+
<li><p>If <var>attribute</var>'s <a for=Attr>element</a> is null, then set <var>attribute</var>'s
71027058
<a for=Attr>value</a> to <var>value</var>.
71037059

7104-
<li>Otherwise, <a lt="change an attribute">change</a> <var>attribute</var> from
7105-
<var>attribute</var>'s <a for=Attr>element</a> to <var>value</var>.
7060+
<li><p>Otherwise, <a lt="change an attribute">change</a> <var>attribute</var> to <var>value</var>.
71067061
</ol>
71077062

71087063
<p>The {{Attr/value}} attribute's setter must <a>set an existing attribute value</a> with

0 commit comments

Comments
 (0)