Skip to content

Commit

Permalink
Move validate and set attribute into append an attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed Apr 10, 2024
1 parent 6565089 commit ac5b4aa
Showing 1 changed file with 29 additions and 39 deletions.
68 changes: 29 additions & 39 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6366,10 +6366,14 @@ given a <var>document</var>, <var>localName</var>, <var>namespace</var>, and opt
</ol>

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

<ol>
<li><p>If <var>sink</var> is not an empty string <a>Validate and set attribute value</a>
<var>attribute</var>'s <a for="Attr">value</a> for <var>attribute</var> with <var>element</var>,
and <var>sink</var>.

<li><p><a for=list>Append</a> <var>attribute</var> to <var>element</var>'s
<a for=Element>attribute list</a>.

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

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

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

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

<li><p>Otherwise, <a lt="append an attribute">append</a> <var>attr</var> to <var>element</var>.
<li><p><a lt="replace an attribute">Replace</a> <var>oldAttr</var> with <var>attr</var>.
</ul>

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

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

<li>
<p>If <var>attribute</var> is null, then:
<ol>
<li><p>Set <var>attribute</var> to a new <a>attribute</a> whose <a for=Attr>namespace</a> is
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
<a for=Attr>local name</a> is <var>localName</var> and <a for=Node>node document</a> is
<var>element</var>'s <a for=Node>node document</a>.

<li><p><a>Validate and set attribute value</a> <var>value</var> for <var>attribute</var> with
<var>element</var>, and <var>sink</var>.

<li><p><a lt="append an attribute">Append</a> <var>attribute</var> to <var>element</var>.

<li><p>Return.
</ol>
<li>If <var>attribute</var> is null, create an <a>attribute</a> whose <a for=Attr>namespace</a> is
<var>namespace</var>, <a for=Attr>namespace prefix</a> is <var>prefix</var>,
<a for=Attr>local name</a> is <var>localName</var>, <a for=Attr>value</a> is <var>value</var>, and
<a for=Node>node document</a> is <var>element</var>'s <a for=Node>node document</a>, then
<a lt="append an attribute">append</a> this <a>attribute</a> to <var>element</var> with
<var>sink</var>, and then return.

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

<li>
<p>If <var>attribute</var> is null, then:

<ol>
<li><p>Set <var>attribute</var> to a new <a>attribute</a> whose <a for=Attr>local name</a> is
<var>qualifiedName</var> and <a for=Node>node document</a> is <a>this</a>'s
<a for=Node>node document</a>.

<li><p><a>Validate and set attribute value</a> <var>value</var> for <var>attribute</var>,
with <a>this</a> and "Element setAttribute".

<li><p><a lt="append an attribute">Append</a> <var>attribute</var> to <a>this</a>.

<li><p>Return.
</ol>
<li><p>If <var>attribute</var> is null, create an <a>attribute</a> whose
<a for=Attr>local name</a> is <var>qualifiedName</var>, <a for=Attr>value</a> is
<var>value</var>, and <a for=Node>node document</a> is <a>this</a>'s <a for=Node>node document</a>,
then <a lt="append an attribute">append</a> this <a>attribute</a> to <a>this</a> with
"Element setAttribute", and then return.

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

<li><p>Return false.
</ol>
Expand Down

0 comments on commit ac5b4aa

Please sign in to comment.