Skip to content

Commit edbc74b

Browse files
committed
Move validate and set attribute into append an attribute
1 parent 2957f73 commit edbc74b

File tree

1 file changed

+29
-39
lines changed

1 file changed

+29
-39
lines changed

dom.bs

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6381,10 +6381,14 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
63816381
</ol>
63826382

63836383
<p>To <dfn export id=concept-element-attributes-append lt="append an attribute">append</dfn> an
6384-
<a>attribute</a> <var>attribute</var> to an <a for=/>element</a> <var>element</var>, run these
6385-
steps:
6384+
<a>attribute</a> <var>attribute</var> to an <a for=/>element</a> <var>element</var>, with optional
6385+
string <var>sink</var> (default ""), run these steps:
63866386

63876387
<ol>
6388+
<li><p>If <var>sink</var> is not an empty string <a>Validate and set attribute value</a>
6389+
<var>attribute</var>'s <a for="Attr">value</a> for <var>attribute</var> with <var>element</var>,
6390+
and <var>sink</var>.
6391+
63886392
<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
63896393
<a for=Element>attribute list</a>.
63906394

@@ -6501,13 +6505,18 @@ and a string <var>sink</var>:
65016505

65026506
<li><p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
65036507

6504-
<li><p><a>Validate and set attribute value</a> <var>newAttr</var>'s <a for="Attr">value</a> for
6505-
<var>newAttr</var> with <var>element</var>, and <var>sink</var>.
6508+
<li>
6509+
<p>If <var>oldAttr</var> is non-null, then:</p>
65066510

6507-
<li><p>If <var>oldAttr</var> is non-null, then <a lt="replace an attribute">replace</a>
6508-
<var>oldAttr</var> with <var>attr</var>.
6511+
<ul>
6512+
<li><p><a>Validate and set attribute value</a> <var>attr</var>'s <a for="Attr">value</a> for
6513+
<var>attr</var> with <var>element</var>, and <var>sink</var>.
65096514

6510-
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>.
6515+
<li><p><a lt="replace an attribute">Replace</a> <var>oldAttr</var> with <var>attr</var>.
6516+
</ul>
6517+
6518+
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>
6519+
with <var>sink</var>.
65116520

65126521
<li><p>Return <var>oldAttr</var>.
65136522
</ol>
@@ -6524,21 +6533,12 @@ or string <var>namespace</var> (default null), and an optional string <var>sink<
65246533
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
65256534
<var>namespace</var>, <var>localName</var>, and <var>element</var>.
65266535

6527-
<li>
6528-
<p>If <var>attribute</var> is null, then:
6529-
<ol>
6530-
<li><p>Set <var>attribute</var> to a new <a>attribute</a> whose <a for=Attr>namespace</a> is
6531-
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6532-
<a for=Attr>local name</a> is <var>localName</var> and <a for=Node>node document</a> is
6533-
<var>element</var>'s <a for=Node>node document</a>.
6534-
6535-
<li><p><a>Validate and set attribute value</a> <var>value</var> for <var>attribute</var> with
6536-
<var>element</var>, and <var>sink</var>.
6537-
6538-
<li><p><a lt="append an attribute">Append</a> <var>attribute</var> to <var>element</var>.
6539-
6540-
<li><p>Return.
6541-
</ol>
6536+
<li>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a> is
6537+
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6538+
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is <var>value</var>, and
6539+
<a for=Node>node document</a> is <var>element</var>'s <a for=Node>node document</a>, then
6540+
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var> with
6541+
<var>sink</var>, and then return.
65426542

65436543
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>, with <var>sink</var>.
65446544
</ol>
@@ -6801,21 +6801,11 @@ method steps are:
68016801
and null otherwise.
68026802
<!-- This is step 2 of "get an attribute by name", modified as appropriate -->
68036803

6804-
<li>
6805-
<p>If <var>attribute</var> is null, then:
6806-
6807-
<ol>
6808-
<li><p>Set <var>attribute</var> to a new <a>attribute</a> whose <a for=Attr>local name</a> is
6809-
<var>qualifiedName</var> and <a for=Node>node document</a> is <a>this</a>'s
6810-
<a for=Node>node document</a>.
6811-
6812-
<li><p><a>Validate and set attribute value</a> <var>value</var> for <var>attribute</var>,
6813-
with <a>this</a> and "Element setAttribute".
6814-
6815-
<li><p><a lt="append an attribute">Append</a> <var>attribute</var> to <a>this</a>.
6816-
6817-
<li><p>Return.
6818-
</ol>
6804+
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose
6805+
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
6806+
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>,
6807+
then <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a> with
6808+
"Element setAttribute", and then return.
68196809

68206810
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>, with "Element setAttribute".
68216811
</ol>
@@ -6878,8 +6868,8 @@ method steps are:
68786868
<li><p>If <var>force</var> is not given or is true, create an <a>attribute</a> whose
68796869
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is the empty
68806870
string, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>, then
6881-
<a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>, and then return
6882-
true.
6871+
<a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a> with
6872+
"Element toggleAttribute", and then return true.
68836873

68846874
<li><p>Return false.
68856875
</ol>

0 commit comments

Comments
 (0)