Skip to content

Commit ac5b4aa

Browse files
committed
Move validate and set attribute into append an attribute
1 parent 6565089 commit ac5b4aa

File tree

1 file changed

+29
-39
lines changed

1 file changed

+29
-39
lines changed

dom.bs

+29-39
Original file line numberDiff line numberDiff line change
@@ -6366,10 +6366,14 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
63666366
</ol>
63676367

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

63726372
<ol>
6373+
<li><p>If <var>sink</var> is not an empty string <a>Validate and set attribute value</a>
6374+
<var>attribute</var>'s <a for="Attr">value</a> for <var>attribute</var> with <var>element</var>,
6375+
and <var>sink</var>.
6376+
63736377
<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
63746378
<a for=Element>attribute list</a>.
63756379

@@ -6486,13 +6490,18 @@ and a string <var>sink</var>:
64866490

64876491
<li><p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
64886492

6489-
<li><p><a>Validate and set attribute value</a> <var>newAttr</var>'s <a for="Attr">value</a> for
6490-
<var>newAttr</var> with <var>element</var>, and <var>sink</var>.
6493+
<li>
6494+
<p>If <var>oldAttr</var> is non-null, then:</p>
64916495

6492-
<li><p>If <var>oldAttr</var> is non-null, then <a lt="replace an attribute">replace</a>
6493-
<var>oldAttr</var> with <var>attr</var>.
6496+
<ul>
6497+
<li><p><a>Validate and set attribute value</a> <var>attr</var>'s <a for="Attr">value</a> for
6498+
<var>attr</var> with <var>element</var>, and <var>sink</var>.
64946499

6495-
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>.
6500+
<li><p><a lt="replace an attribute">Replace</a> <var>oldAttr</var> with <var>attr</var>.
6501+
</ul>
6502+
6503+
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>
6504+
with <var>sink</var>.
64966505

64976506
<li><p>Return <var>oldAttr</var>.
64986507
</ol>
@@ -6509,21 +6518,12 @@ or string <var>namespace</var> (default null), and an optional string <var>sink<
65096518
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
65106519
<var>namespace</var>, <var>localName</var>, and <var>element</var>.
65116520

6512-
<li>
6513-
<p>If <var>attribute</var> is null, then:
6514-
<ol>
6515-
<li><p>Set <var>attribute</var> to a new <a>attribute</a> whose <a for=Attr>namespace</a> is
6516-
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6517-
<a for=Attr>local name</a> is <var>localName</var> and <a for=Node>node document</a> is
6518-
<var>element</var>'s <a for=Node>node document</a>.
6519-
6520-
<li><p><a>Validate and set attribute value</a> <var>value</var> for <var>attribute</var> with
6521-
<var>element</var>, and <var>sink</var>.
6522-
6523-
<li><p><a lt="append an attribute">Append</a> <var>attribute</var> to <var>element</var>.
6524-
6525-
<li><p>Return.
6526-
</ol>
6521+
<li>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a> is
6522+
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
6523+
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is <var>value</var>, and
6524+
<a for=Node>node document</a> is <var>element</var>'s <a for=Node>node document</a>, then
6525+
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var> with
6526+
<var>sink</var>, and then return.
65276527

65286528
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>, with <var>sink</var>.
65296529
</ol>
@@ -6786,21 +6786,11 @@ method steps are:
67866786
and null otherwise.
67876787
<!-- This is step 2 of "get an attribute by name", modified as appropriate -->
67886788

6789-
<li>
6790-
<p>If <var>attribute</var> is null, then:
6791-
6792-
<ol>
6793-
<li><p>Set <var>attribute</var> to a new <a>attribute</a> whose <a for=Attr>local name</a> is
6794-
<var>qualifiedName</var> and <a for=Node>node document</a> is <a>this</a>'s
6795-
<a for=Node>node document</a>.
6796-
6797-
<li><p><a>Validate and set attribute value</a> <var>value</var> for <var>attribute</var>,
6798-
with <a>this</a> and "Element setAttribute".
6799-
6800-
<li><p><a lt="append an attribute">Append</a> <var>attribute</var> to <a>this</a>.
6801-
6802-
<li><p>Return.
6803-
</ol>
6789+
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose
6790+
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
6791+
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>,
6792+
then <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a> with
6793+
"Element setAttribute", and then return.
68046794

68056795
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>, with "Element setAttribute".
68066796
</ol>
@@ -6863,8 +6853,8 @@ method steps are:
68636853
<li><p>If <var>force</var> is not given or is true, create an <a>attribute</a> whose
68646854
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is the empty
68656855
string, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>, then
6866-
<a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>, and then return
6867-
true.
6856+
<a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a> with
6857+
"Element toggleAttribute", and then return true.
68686858

68696859
<li><p>Return false.
68706860
</ol>

0 commit comments

Comments
 (0)