Skip to content

Commit 489a5c1

Browse files
committed
Move validate and set attribute into append an attribute
1 parent e7880fd commit 489a5c1

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
@@ -6384,10 +6384,14 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
63846384
</ol>
63856385

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

63906390
<ol>
6391+
<li><p>If <var>sink</var> is not an empty string <a>Validate and set attribute value</a>
6392+
<var>attribute</var>'s <a for="Attr">value</a> for <var>attribute</var> with <var>element</var>,
6393+
and <var>sink</var>.
6394+
63916395
<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
63926396
<a for=Element>attribute list</a>.
63936397

@@ -6504,13 +6508,18 @@ and a string <var>sink</var>:
65046508

65056509
<li><p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
65066510

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

6510-
<li><p>If <var>oldAttr</var> is non-null, then <a lt="replace an attribute">replace</a>
6511-
<var>oldAttr</var> with <var>attr</var>.
6514+
<ul>
6515+
<li><p><a>Validate and set attribute value</a> <var>attr</var>'s <a for="Attr">value</a> for
6516+
<var>attr</var> with <var>element</var>, and <var>sink</var>.
65126517

6513-
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>.
6518+
<li><p><a lt="replace an attribute">Replace</a> <var>oldAttr</var> with <var>attr</var>.
6519+
</ul>
6520+
6521+
<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>
6522+
with <var>sink</var>.
65146523

65156524
<li><p>Return <var>oldAttr</var>.
65166525
</ol>
@@ -6527,21 +6536,12 @@ or string <var>namespace</var> (default null), and an optional string <var>sink<
65276536
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
65286537
<var>namespace</var>, <var>localName</var>, and <var>element</var>.
65296538

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

65466546
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>, with <var>sink</var>.
65476547
</ol>
@@ -6804,21 +6804,11 @@ method steps are:
68046804
and null otherwise.
68056805
<!-- This is step 2 of "get an attribute by name", modified as appropriate -->
68066806

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

68236813
<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>, with "Element setAttribute".
68246814
</ol>
@@ -6881,8 +6871,8 @@ method steps are:
68816871
<li><p>If <var>force</var> is not given or is true, create an <a>attribute</a> whose
68826872
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is the empty
68836873
string, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>, then
6884-
<a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a>, and then return
6885-
true.
6874+
<a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a> with
6875+
"Element toggleAttribute", and then return true.
68866876

68876877
<li><p>Return false.
68886878
</ol>

0 commit comments

Comments
 (0)