Skip to content

Commit

Permalink
Editorial: add some <div algorithm> wrappers
Browse files Browse the repository at this point in the history
And improve the algorithm "headers" at the same time by listing the argument types and default values.
  • Loading branch information
annevk committed Dec 15, 2022
1 parent 2f37778 commit 0a00afb
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6264,8 +6264,9 @@ steps:

<hr>

<div algorithm>
<p>To <dfn export id=concept-element-attributes-get-by-name>get an attribute by name</dfn> given a
<var>qualifiedName</var> and <a for=/>element</a> <var>element</var>, run these steps:
string <var>qualifiedName</var> and an <a for=/>element</a> <var>element</var>:

<ol>
<li><p>If <var>element</var> is in the <a>HTML namespace</a> and its <a for=Node>node document</a>
Expand All @@ -6275,11 +6276,13 @@ steps:
<li><p>Return the first <a>attribute</a> in <var>element</var>'s <a for=Element>attribute list</a>
whose <a for=Attr>qualified name</a> is <var>qualifiedName</var>; otherwise null.
</ol>
</div>

<div algorithm>
<p>To
<dfn export id=concept-element-attributes-get-by-namespace>get an attribute by namespace and local name</dfn>
given a <var>namespace</var>, <var>localName</var>, and <a for=/>element</a> <var>element</var>,
run these steps:
given null or a string <var>namespace</var>, a string <var>localName</var>, and an
<a for=/>element</a> <var>element</var>:

<ol>
<li><p>If <var>namespace</var> is the empty string, then set it to null.
Expand All @@ -6288,10 +6291,12 @@ run these steps:
<a for=Attr>namespace</a> is <var>namespace</var> and <a for=Attr>local name</a> is
<var>localName</var>, if any; otherwise null.
</ol>
</div>

<div algorithm>
<p>To <dfn export id=concept-element-attributes-get-value>get an attribute value</dfn> given an
<a for=/>element</a> <var>element</var>, <var>localName</var>, and optionally a <var>namespace</var>
(null unless stated otherwise), run these steps:</p>
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, and an optional null or
string <var>namespace</var> (default null):</p>

<ol>
<li><p>Let <var>attr</var> be the result of
Expand All @@ -6302,9 +6307,11 @@ run these steps:

<li><p>Return <var>attr</var>'s <a for=Attr>value</a>.</p></li>
</ol>
</div>

<div algorithm>
<p>To <dfn export id=concept-element-attributes-set>set an attribute</dfn> given an
<var>attr</var> and <var>element</var>, run these steps:
<a for=/>attribute</a> <var>attr</var> and an <a for=/>element</a> <var>element</var>:

<ol>
<li><p>If <var>attr</var>'s <a for=Attr>element</a> is neither null nor <var>element</var>,
Expand All @@ -6324,16 +6331,15 @@ run these steps:

<li><p>Return <var>oldAttr</var>.
</ol>
</div>

<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> for an
<a for=/>element</a> <var>element</var>, using a <var>localName</var> and <var>value</var>, and an
optional <var>prefix</var>, and <var>namespace</var>, run these steps:
<div algorithm>
<p>To <dfn export id=concept-element-attributes-set-value>set an attribute value</dfn> given an
<a for=/>element</a> <var>element</var>, a string <var>localName</var>, a string <var>value</var>,
an optional null or string <var>prefix</var> (default null), and an optional null or string
<var>namespace</var> (default null):

<ol>
<li>If <var>prefix</var> is not given, set it to null.

<li>If <var>namespace</var> is not given, set it to null.

<li>Let <var>attribute</var> be the result of
<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>.
Expand All @@ -6347,9 +6353,11 @@ optional <var>prefix</var>, and <var>namespace</var>, run these steps:

<li><p><a lt="change an attribute">Change</a> <var>attribute</var> to <var>value</var>.
</ol>
</div>

<div algorithm>
<p>To <dfn export id=concept-element-attributes-remove-by-name>remove an attribute by name</dfn>
given a <var>qualifiedName</var> and <a for=/>element</a> <var>element</var>, run these steps:
given a string <var>qualifiedName</var> and an <a for=/>element</a> <var>element</var>:

<ol>
<li><p>Let <var>attr</var> be the result of
Expand All @@ -6360,11 +6368,13 @@ given a <var>qualifiedName</var> and <a for=/>element</a> <var>element</var>, ru

<li><p>Return <var>attr</var>.
</ol>
</div>

<div algorithm>
<p>To
<dfn export id=concept-element-attributes-remove-by-namespace>remove an attribute by namespace and local name</dfn>
given a <var>namespace</var>, <var>localName</var>, and <a for=/>element</a> <var>element</var>,
run these steps:
given null or a string <var>namespace</var>, a string <var>localName</var>, and an
<a for=/>element</a> <var>element</var>:

<ol>
<li><p>Let <var>attr</var> be the result of
Expand All @@ -6375,6 +6385,7 @@ run these steps:

<li><p>Return <var>attr</var>.
</ol>
</div>

<hr>

Expand Down

0 comments on commit 0a00afb

Please sign in to comment.