Skip to content

Commit a0042ff

Browse files
committed
Fix #117: alias setAttributeNode to setAttributeNodeNS and setNamedItem to setNamedItemNS
1 parent 144f011 commit a0042ff

File tree

2 files changed

+31
-75
lines changed

2 files changed

+31
-75
lines changed

Diff for: dom.bs

+16-57
Original file line numberDiff line numberDiff line change
@@ -5174,46 +5174,23 @@ given a <var>namespace</var>, <var>localName</var>, and
51745174
</ol>
51755175

51765176
To <dfn export id=concept-element-attributes-set>set an attribute</dfn> given an
5177-
<a>attribute</a> <var>attr</var>,
5178-
<a for="/">element</a> <var>element</var>, and an optional
5179-
<i>namespace and local name flag</i>, run these steps:
5177+
<var>attr</var> and <var>element</var>, run these steps:
51805178

51815179
<ol>
5182-
<li>If <var>attr</var>'s <a for=Attr>element</a> is
5183-
neither null nor <var>element</var>, <a>throw</a> an
5184-
{{InUseAttributeError}}.
5180+
<li><p>If <var>attr</var>'s <a for=Attr>element</a> is neither null nor <var>element</var>,
5181+
<a>throw</a> an {{InUseAttributeError}}.
51855182

5186-
<li>Let <var>oldAttr</var> be null.
5187-
5188-
<li>If the <i>namespace and local name flag</i> is set, set <var>oldAttr</var>
5189-
to the result of
5190-
<a lt="get an attribute by namespace and local name">getting an attribute</a>
5191-
given <var>attr</var>'s <a for="Attr">namespace</a>,
5192-
<var>attr</var>'s <a for="Attr">local name</a>, and
5183+
<li><p>Let <var>oldAttr</var> be the result of
5184+
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
5185+
<var>attr</var>'s <a for="Attr">namespace</a>, <var>attr</var>'s <a for="Attr">local name</a>, and
51935186
<var>element</var>.
51945187

5195-
<li>
5196-
<p>Otherwise, set <var>oldAttr</var> to the result of
5197-
<a lt="get an attribute by name">getting an attribute</a> given <var>attr</var>'s
5198-
<a for=Attr>local name</a> and <var>element</var>.
5199-
5200-
<p class="note no-backref">The result of this is that an
5201-
<a>attribute</a> on an
5202-
<a for="/">element</a> with an <a>HTML namespace</a> in an
5203-
<a>HTML document</a> can be replaced with another
5204-
<a>attribute</a> whose
5205-
<a for=Attr>qualified name</a> is only an
5206-
<a>ASCII case-insensitive</a> match. We do not care, because nobody ought to be
5207-
working with <a>attributes</a> in this way.
5208-
5209-
<li>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
5210-
5211-
<li>If <var>oldAttr</var> is non-null,
5212-
<a lt="remove an attribute">remove</a> it from
5188+
<li><p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
5189+
5190+
<li><p>If <var>oldAttr</var> is non-null, <a lt="remove an attribute">remove</a> it from
52135191
<var>element</var>.
52145192

5215-
<li><a lt="append an attribute">Append</a> <var>attr</var>
5216-
to <var>element</var>.
5193+
<li><p><a lt="append an attribute">Append</a> <var>attr</var> to <var>element</var>.
52175194

52185195
<li>Return <var>oldAttr</var>.
52195196
</ol>
@@ -5564,19 +5541,11 @@ method, when invoked, must return the result of
55645541
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
55655542
<var>namespace</var>, <var>localName</var>, and the <a>context object</a>.
55665543

5567-
The
5568-
<dfn method for="Element">setAttributeNode(<var>attr</var>)</dfn>
5569-
method, when invoked, must return the result of
5570-
<a lt="set an attribute">setting an attribute</a> given
5544+
The <dfn method for="Element"><code>setAttributeNode(<var>attr</var>)</code></dfn> and
5545+
<dfn method for="Element"><code>setAttributeNodeNS(<var>attr</var>)</code></dfn> methods, when
5546+
invoked, must return the result of <a lt="set an attribute">setting an attribute</a> given
55715547
<var>attr</var> and the <a>context object</a>. Rethrow any exceptions.
55725548

5573-
The
5574-
<dfn method for="Element">setAttributeNodeNS(<var>attr</var>)</dfn>
5575-
method, when invoked, must return the result of
5576-
<a lt="set an attribute">setting an attribute</a> given
5577-
<var>attr</var>, the <a>context object</a>, and
5578-
<i>namespace and local name flag</i> set. Rethrow any exceptions.
5579-
55805549
The
55815550
<dfn method for="Element">removeAttributeNode(<var>attr</var>)</dfn>
55825551
method, when invoked, must run these steps:
@@ -5740,19 +5709,9 @@ method, when invoked, must return the result of
57405709
<var>namespace</var>, <var>localName</var>, and
57415710
<a for=NamedNodeMap>element</a>.
57425711

5743-
The
5744-
<dfn method for="NamedNodeMap">setNamedItem(<var>attr</var>)</dfn>
5745-
method, when invoked, must return the result of
5746-
<a lt="set an attribute">setting an attribute</a> given
5747-
<var>attr</var> and <a for=NamedNodeMap>element</a>. Rethrow
5748-
any exceptions.
5749-
5750-
The
5751-
<dfn method for="NamedNodeMap">setNamedItemNS(<var>attr</var>)</dfn>
5752-
method, when invoked, must return the result of
5753-
<a lt="set an attribute">setting an attribute</a> given
5754-
<var>attr</var>, <a for=NamedNodeMap>element</a>, and
5755-
<i>namespace and local name flag</i> set. Rethrow any exceptions.
5712+
The <dfn method for="NamedNodeMap"><code>setNamedItem(<var>attr</var>)</code></dfn> and
5713+
<dfn method for="NamedNodeMap"><code>setNamedItemNS(<var>attr</var>)</code></dfn>
5714+
methods, when invoked, must return the result of <a lt="set an attribute">setting an attribute</a> given <var>attr</var> and <a for=NamedNodeMap>element</a>. Rethrow any exceptions.
57565715

57575716
The
57585717
<dfn method for="NamedNodeMap">removeNamedItem(<var>name</var>)</dfn>

Diff for: dom.html

+15-18
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<div class="head">
7070
<p data-fill-with="logo"><a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" height="100" src="https://resources.whatwg.org/logo-dom.svg"> </a> </p>
7171
<h1 class="p-name no-ref allcaps" id="title">DOM</h1>
72-
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="2015-11-23">23 November 2015</time></span></h2>
72+
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="2015-11-24">24 November 2015</time></span></h2>
7373
<div data-fill-with="spec-metadata">
7474
<dl>
7575
<dt>Participate:
@@ -2744,19 +2744,18 @@ <h3 class="heading settled" data-level="4.8" id="interface-element"><span class=
27442744
<li>If <var>namespace</var> is the empty string, set it to null.
27452745
<li>Return the <a data-link-type="dfn" href="#concept-attribute">attribute</a> in <var>element</var>’s <a data-link-type="dfn" href="#concept-element-attribute">attribute list</a> whose <a data-link-type="dfn" href="#concept-attribute-namespace">namespace</a> is <var>namespace</var> and <a data-link-type="dfn" href="#concept-attribute-local-name">local name</a> is <var>localName</var>, if any, and null otherwise.
27462746
</ol>
2747-
<p>To <dfn data-dfn-type="dfn" data-export="" id="concept-element-attributes-set">set an attribute<a class="self-link" href="#concept-element-attributes-set"></a></dfn> given an <a data-link-type="dfn" href="#concept-attribute">attribute</a> <var>attr</var>, <a data-link-type="dfn" href="#concept-element">element</a> <var>element</var>, and an optional <i>namespace and local name flag</i>, run these steps:</p>
2747+
<p>To <dfn data-dfn-type="dfn" data-export="" id="concept-element-attributes-set">set an attribute<a class="self-link" href="#concept-element-attributes-set"></a></dfn> given an <var>attr</var> and <var>element</var>, run these steps:</p>
27482748
<ol>
2749-
<li>If <var>attr</var>’s <a data-link-type="dfn" href="#concept-attribute-element">element</a> is
2750-
neither null nor <var>element</var>, <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw">throw</a> an <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#inuseattributeerror">InUseAttributeError</a></code>.
2751-
<li>Let <var>oldAttr</var> be null.
2752-
<li>If the <i>namespace and local name flag</i> is set, set <var>oldAttr</var> to the result of <a data-link-type="dfn" href="#concept-element-attributes-get-by-namespace">getting an attribute</a> given <var>attr</var>’s <a data-link-type="dfn" href="#concept-attribute-namespace">namespace</a>, <var>attr</var>’s <a data-link-type="dfn" href="#concept-attribute-local-name">local name</a>, and <var>element</var>.
2753-
<li>
2754-
<p>Otherwise, set <var>oldAttr</var> to the result of <a data-link-type="dfn" href="#concept-element-attributes-get-by-name">getting an attribute</a> given <var>attr</var>’s <a data-link-type="dfn" href="#concept-attribute-local-name">local name</a> and <var>element</var>. </p>
2755-
<p class="note no-backref" role="note">The result of this is that an <a data-link-type="dfn" href="#concept-attribute">attribute</a> on an <a data-link-type="dfn" href="#concept-element">element</a> with an <a data-link-type="dfn" href="#html-namespace">HTML namespace</a> in an <a data-link-type="dfn" href="#html-document">HTML document</a> can be replaced with another <a data-link-type="dfn" href="#concept-attribute">attribute</a> whose <a data-link-type="dfn" href="#concept-attribute-qualified-name">qualified name</a> is only an <a data-link-type="dfn" href="#ascii-case-insensitive">ASCII case-insensitive</a> match. We do not care, because nobody ought to be
2756-
working with <a data-link-type="dfn" href="#concept-attribute">attributes</a> in this way. </p>
2757-
<li>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
2758-
<li>If <var>oldAttr</var> is non-null, <a data-link-type="dfn" href="#concept-element-attributes-remove">remove</a> it from <var>element</var>.
2759-
<li><a data-link-type="dfn" href="#concept-element-attributes-append">Append</a> <var>attr</var> to <var>element</var>.
2749+
<li>
2750+
<p>If <var>attr</var>’s <a data-link-type="dfn" href="#concept-attribute-element">element</a> is neither null nor <var>element</var>, <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw">throw</a> an <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#inuseattributeerror">InUseAttributeError</a></code>. </p>
2751+
<li>
2752+
<p>Let <var>oldAttr</var> be the result of <a data-link-type="dfn" href="#concept-element-attributes-get-by-namespace">getting an attribute</a> given <var>attr</var>’s <a data-link-type="dfn" href="#concept-attribute-namespace">namespace</a>, <var>attr</var>’s <a data-link-type="dfn" href="#concept-attribute-local-name">local name</a>, and <var>element</var>. </p>
2753+
<li>
2754+
<p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>. </p>
2755+
<li>
2756+
<p>If <var>oldAttr</var> is non-null, <a data-link-type="dfn" href="#concept-element-attributes-remove">remove</a> it from <var>element</var>. </p>
2757+
<li>
2758+
<p><a data-link-type="dfn" href="#concept-element-attributes-append">Append</a> <var>attr</var> to <var>element</var>. </p>
27602759
<li>Return <var>oldAttr</var>.
27612760
</ol>
27622761
<p>To <dfn data-dfn-type="dfn" data-export="" id="concept-element-attributes-set-value">set an attribute value<a class="self-link" href="#concept-element-attributes-set-value"></a></dfn> for
@@ -2892,8 +2891,8 @@ <h3 class="heading settled" data-level="4.8" id="interface-element"><span class=
28922891
<hr>
28932892
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-getattributenode">getAttributeNode(<var>name</var>)<a class="self-link" href="#dom-element-getattributenode"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-get-by-name">getting an attribute</a> given <var>name</var> and the <a data-link-type="dfn" href="#context-object">context object</a>.</p>
28942893
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-getattributenodens">getAttributeNodeNS(<var>namespace</var>, <var>localName</var>)<a class="self-link" href="#dom-element-getattributenodens"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-get-by-namespace">getting an attribute</a> given <var>namespace</var>, <var>localName</var>, and the <a data-link-type="dfn" href="#context-object">context object</a>.</p>
2895-
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-setattributenode">setAttributeNode(<var>attr</var>)<a class="self-link" href="#dom-element-setattributenode"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-set">setting an attribute</a> given <var>attr</var> and the <a data-link-type="dfn" href="#context-object">context object</a>. Rethrow any exceptions.</p>
2896-
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-setattributenodens">setAttributeNodeNS(<var>attr</var>)<a class="self-link" href="#dom-element-setattributenodens"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-set">setting an attribute</a> given <var>attr</var>, the <a data-link-type="dfn" href="#context-object">context object</a>, and <i>namespace and local name flag</i> set. Rethrow any exceptions.</p>
2894+
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-setattributenode"><code>setAttributeNode(<var>attr</var>)</code><a class="self-link" href="#dom-element-setattributenode"></a></dfn> and <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-setattributenodens"><code>setAttributeNodeNS(<var>attr</var>)</code><a class="self-link" href="#dom-element-setattributenodens"></a></dfn> methods, when
2895+
invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-set">setting an attribute</a> given <var>attr</var> and the <a data-link-type="dfn" href="#context-object">context object</a>. Rethrow any exceptions.</p>
28972896
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-removeattributenode">removeAttributeNode(<var>attr</var>)<a class="self-link" href="#dom-element-removeattributenode"></a></dfn> method, when invoked, must run these steps:</p>
28982897
<ol>
28992898
<li>If <var>attr</var> is not in <a data-link-type="dfn" href="#context-object">context object</a>’s <a data-link-type="dfn" href="#concept-element-attribute">attribute list</a>, <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#notfounderror">NotFoundError</a></code> exception.
@@ -2958,9 +2957,7 @@ <h4 class="heading settled" data-level="4.8.1" id="interface-namednodemap"><span
29582957
<p>A <code class="idl"><a data-link-type="idl" href="#namednodemap">NamedNodeMap</a></code> object’s <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-supported-property-names">supported property names</a>, all <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-unenumerable">unenumerable</a>, are the <a data-link-type="dfn" href="#concept-attribute-qualified-name">qualified names</a> of the <a data-link-type="dfn" href="#concept-attribute">attributes</a> in the <a data-link-type="dfn" href="#concept-namednodemap-attribute">attribute list</a>, in order. </p>
29592958
<p>The <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-getnameditem">getNamedItem(<var>name</var>)<a class="self-link" href="#dom-namednodemap-getnameditem"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-get-by-name">getting an attribute</a> given <var>name</var> and <a data-link-type="dfn" href="#concept-namednodemap-element">element</a>.</p>
29602959
<p>The <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-getnameditemns">getNamedItemNS(<var>namespace</var>, <var>localName</var>)<a class="self-link" href="#dom-namednodemap-getnameditemns"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-get-by-namespace">getting an attribute</a> given <var>namespace</var>, <var>localName</var>, and <a data-link-type="dfn" href="#concept-namednodemap-element">element</a>.</p>
2961-
<p>The <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-setnameditem">setNamedItem(<var>attr</var>)<a class="self-link" href="#dom-namednodemap-setnameditem"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-set">setting an attribute</a> given <var>attr</var> and <a data-link-type="dfn" href="#concept-namednodemap-element">element</a>. Rethrow
2962-
any exceptions.</p>
2963-
<p>The <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-setnameditemns">setNamedItemNS(<var>attr</var>)<a class="self-link" href="#dom-namednodemap-setnameditemns"></a></dfn> method, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-set">setting an attribute</a> given <var>attr</var>, <a data-link-type="dfn" href="#concept-namednodemap-element">element</a>, and <i>namespace and local name flag</i> set. Rethrow any exceptions.</p>
2960+
<p>The <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-setnameditem"><code>setNamedItem(<var>attr</var>)</code><a class="self-link" href="#dom-namednodemap-setnameditem"></a></dfn> and <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-setnameditemns"><code>setNamedItemNS(<var>attr</var>)</code><a class="self-link" href="#dom-namednodemap-setnameditemns"></a></dfn> methods, when invoked, must return the result of <a data-link-type="dfn" href="#concept-element-attributes-set">setting an attribute</a> given <var>attr</var> and <a data-link-type="dfn" href="#concept-namednodemap-element">element</a>. Rethrow any exceptions.</p>
29642961
<p>The <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-removenameditem">removeNamedItem(<var>name</var>)<a class="self-link" href="#dom-namednodemap-removenameditem"></a></dfn> method, when invoked, must run these steps:</p>
29652962
<ol>
29662963
<li>Let <var>attr</var> be the result of <a data-link-type="dfn" href="#concept-element-attributes-remove-by-name">removing an attribute</a> given <var>name</var> and <a data-link-type="dfn" href="#concept-namednodemap-element">element</a>.

0 commit comments

Comments
 (0)