Skip to content

Commit

Permalink
Fix #117: alias setAttributeNode to setAttributeNodeNS and setNamedIt…
Browse files Browse the repository at this point in the history
…em to setNamedItemNS
  • Loading branch information
annevk committed Nov 24, 2015
1 parent 144f011 commit a0042ff
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 75 deletions.
73 changes: 16 additions & 57 deletions dom.bs
Expand Up @@ -5174,46 +5174,23 @@ given a <var>namespace</var>, <var>localName</var>, and
</ol>

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

<ol>
<li>If <var>attr</var>'s <a for=Attr>element</a> is
neither null nor <var>element</var>, <a>throw</a> an
{{InUseAttributeError}}.
<li><p>If <var>attr</var>'s <a for=Attr>element</a> is neither null nor <var>element</var>,
<a>throw</a> an {{InUseAttributeError}}.

<li>Let <var>oldAttr</var> be null.

<li>If the <i>namespace and local name flag</i> is set, set <var>oldAttr</var>
to the result of
<a lt="get an attribute by namespace and local name">getting an attribute</a>
given <var>attr</var>'s <a for="Attr">namespace</a>,
<var>attr</var>'s <a for="Attr">local name</a>, and
<li><p>Let <var>oldAttr</var> be the result of
<a lt="get an attribute by namespace and local name">getting an attribute</a> given
<var>attr</var>'s <a for="Attr">namespace</a>, <var>attr</var>'s <a for="Attr">local name</a>, and
<var>element</var>.

<li>
<p>Otherwise, set <var>oldAttr</var> to the result of
<a lt="get an attribute by name">getting an attribute</a> given <var>attr</var>'s
<a for=Attr>local name</a> and <var>element</var>.

<p class="note no-backref">The result of this is that an
<a>attribute</a> on an
<a for="/">element</a> with an <a>HTML namespace</a> in an
<a>HTML document</a> can be replaced with another
<a>attribute</a> whose
<a for=Attr>qualified name</a> is only an
<a>ASCII case-insensitive</a> match. We do not care, because nobody ought to be
working with <a>attributes</a> in this way.

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

<li>If <var>oldAttr</var> is non-null,
<a lt="remove an attribute">remove</a> it from
<li><p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.

<li><p>If <var>oldAttr</var> is non-null, <a lt="remove an attribute">remove</a> it from
<var>element</var>.

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

<li>Return <var>oldAttr</var>.
</ol>
Expand Down Expand Up @@ -5564,19 +5541,11 @@ method, when invoked, must return 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 the <a>context object</a>.

The
<dfn method for="Element">setAttributeNode(<var>attr</var>)</dfn>
method, when invoked, must return the result of
<a lt="set an attribute">setting an attribute</a> given
The <dfn method for="Element"><code>setAttributeNode(<var>attr</var>)</code></dfn> and
<dfn method for="Element"><code>setAttributeNodeNS(<var>attr</var>)</code></dfn> methods, when
invoked, must return the result of <a lt="set an attribute">setting an attribute</a> given
<var>attr</var> and the <a>context object</a>. Rethrow any exceptions.

The
<dfn method for="Element">setAttributeNodeNS(<var>attr</var>)</dfn>
method, when invoked, must return the result of
<a lt="set an attribute">setting an attribute</a> given
<var>attr</var>, the <a>context object</a>, and
<i>namespace and local name flag</i> set. Rethrow any exceptions.

The
<dfn method for="Element">removeAttributeNode(<var>attr</var>)</dfn>
method, when invoked, must run these steps:
Expand Down Expand Up @@ -5740,19 +5709,9 @@ method, when invoked, must return the result of
<var>namespace</var>, <var>localName</var>, and
<a for=NamedNodeMap>element</a>.

The
<dfn method for="NamedNodeMap">setNamedItem(<var>attr</var>)</dfn>
method, 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.

The
<dfn method for="NamedNodeMap">setNamedItemNS(<var>attr</var>)</dfn>
method, when invoked, must return the result of
<a lt="set an attribute">setting an attribute</a> given
<var>attr</var>, <a for=NamedNodeMap>element</a>, and
<i>namespace and local name flag</i> set. Rethrow any exceptions.
The <dfn method for="NamedNodeMap"><code>setNamedItem(<var>attr</var>)</code></dfn> and
<dfn method for="NamedNodeMap"><code>setNamedItemNS(<var>attr</var>)</code></dfn>
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.

The
<dfn method for="NamedNodeMap">removeNamedItem(<var>name</var>)</dfn>
Expand Down
33 changes: 15 additions & 18 deletions dom.html
Expand Up @@ -69,7 +69,7 @@
<div class="head">
<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>
<h1 class="p-name no-ref allcaps" id="title">DOM</h1>
<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>
<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>
<div data-fill-with="spec-metadata">
<dl>
<dt>Participate:
Expand Down Expand Up @@ -2744,19 +2744,18 @@ <h3 class="heading settled" data-level="4.8" id="interface-element"><span class=
<li>If <var>namespace</var> is the empty string, set it to null.
<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.
</ol>
<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>
<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>
<ol>
<li>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>.
<li>Let <var>oldAttr</var> be null.
<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>.
<li>
<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>
<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
working with <a data-link-type="dfn" href="#concept-attribute">attributes</a> in this way. </p>
<li>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>.
<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>.
<li><a data-link-type="dfn" href="#concept-element-attributes-append">Append</a> <var>attr</var> to <var>element</var>.
<li>
<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>
<li>
<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>
<li>
<p>If <var>oldAttr</var> is <var>attr</var>, return <var>attr</var>. </p>
<li>
<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>
<li>
<p><a data-link-type="dfn" href="#concept-element-attributes-append">Append</a> <var>attr</var> to <var>element</var>. </p>
<li>Return <var>oldAttr</var>.
</ol>
<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
Expand Down Expand Up @@ -2892,8 +2891,8 @@ <h3 class="heading settled" data-level="4.8" id="interface-element"><span class=
<hr>
<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>
<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>
<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>
<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>
<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
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>
<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>
<ol>
<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.
Expand Down Expand Up @@ -2958,9 +2957,7 @@ <h4 class="heading settled" data-level="4.8.1" id="interface-namednodemap"><span
<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>
<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>
<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>
<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
any exceptions.</p>
<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>
<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>
<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>
<ol>
<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>.
Expand Down

0 comments on commit a0042ff

Please sign in to comment.