Skip to content

Commit

Permalink
Fix #115: add getAttributeNames()
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Nov 25, 2015
1 parent a0042ff commit fb45d52
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5018,6 +5018,7 @@ interface Element : Node {

boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
sequence<DOMString> getAttributeNames();
DOMString? getAttribute(DOMString name);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
void setAttribute(DOMString name, DOMString value);
Expand Down Expand Up @@ -5416,6 +5417,13 @@ otherwise.
The <dfn attribute for="Element">attributes</dfn>
attribute must return the associated {{NamedNodeMap}}.

The <dfn method for=Element><code>getAttributeNames()</code></dfn> method, when invoked, must return
the <a for=Attr>qualified names</a> of the <a>attributes</a> in the <a>context object</a>'s
<a for=Element>attribute list</a>, in order.

<p class=note>These are not guaranteed to be unique.<!-- A theoretical getAttributeNamesNS() could
return an array of unique two-value-arrays. -->

The <dfn method for="Element">getAttribute(<var>name</var>)</dfn> method must run these steps:
<ol>
<li>Let <var>attr</var> be the result of
Expand Down Expand Up @@ -9043,6 +9051,7 @@ Dominic Cooney,
Dominique Hazaël-Massieux,
Don Jordan,
Doug Schepers,
Elliott Sprehn,
Erik Arvidsson,
Gavin Nicol,
Geoffrey Sneddon,
Expand Down
9 changes: 8 additions & 1 deletion dom.html
Original file line number Diff line number Diff line change
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-24">24 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-25">25 November 2015</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>Participate:
Expand Down Expand Up @@ -2675,6 +2675,7 @@ <h3 class="heading settled" data-level="4.8" id="interface-element"><span class=

boolean <a class="idl-code" data-link-type="method" href="#dom-element-hasattributes">hasAttributes</a>();
[SameObject] readonly attribute <a data-link-type="idl-name" href="#namednodemap">NamedNodeMap</a> <a class="idl-code" data-link-type="attribute" data-readonly="" data-type="NamedNodeMap " href="#dom-element-attributes">attributes</a>;
sequence&lt;DOMString> <a class="idl-code" data-link-type="method" href="#dom-element-getattributenames">getAttributeNames</a>();
DOMString? <a class="idl-code" data-link-type="method" href="#dom-element-getattribute">getAttribute</a>(DOMString <dfn class="idl-code" data-dfn-for="Element/getAttribute(name)" data-dfn-type="argument" data-export="" id="dom-element-getattribute-name-name">name<a class="self-link" href="#dom-element-getattribute-name-name"></a></dfn>);
DOMString? <a class="idl-code" data-link-type="method" href="#dom-element-getattributens">getAttributeNS</a>(DOMString? <dfn class="idl-code" data-dfn-for="Element/getAttributeNS(namespace, localName)" data-dfn-type="argument" data-export="" id="dom-element-getattributens-namespace-localname-namespace">namespace<a class="self-link" href="#dom-element-getattributens-namespace-localname-namespace"></a></dfn>, DOMString <dfn class="idl-code" data-dfn-for="Element/getAttributeNS(namespace, localName)" data-dfn-type="argument" data-export="" id="dom-element-getattributens-namespace-localname-localname">localName<a class="self-link" href="#dom-element-getattributens-namespace-localname-localname"></a></dfn>);
void <a class="idl-code" data-link-type="method" href="#dom-element-setattribute">setAttribute</a>(DOMString <dfn class="idl-code" data-dfn-for="Element/setAttribute(name, value)" data-dfn-type="argument" data-export="" id="dom-element-setattribute-name-value-name">name<a class="self-link" href="#dom-element-setattribute-name-value-name"></a></dfn>, DOMString <dfn class="idl-code" data-dfn-for="Element/setAttribute(name, value)" data-dfn-type="argument" data-export="" id="dom-element-setattribute-name-value-value">value<a class="self-link" href="#dom-element-setattribute-name-value-value"></a></dfn>);
Expand Down Expand Up @@ -2845,6 +2846,9 @@ <h3 class="heading settled" data-level="4.8" id="interface-element"><span class=
when invoked, must return false if <a data-link-type="dfn" href="#context-object">context object</a>’s <a data-link-type="dfn" href="#concept-element-attribute">attribute list</a> is empty, and true
otherwise.</p>
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="attribute" data-export="" id="dom-element-attributes">attributes<a class="self-link" href="#dom-element-attributes"></a></dfn> attribute must return the associated <code class="idl"><a data-link-type="idl" href="#namednodemap">NamedNodeMap</a></code>.</p>
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-getattributenames"><code>getAttributeNames()</code><a class="self-link" href="#dom-element-getattributenames"></a></dfn> method, when invoked, must return
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="#context-object">context object</a>’s <a data-link-type="dfn" href="#concept-element-attribute">attribute list</a>, in order.</p>
<p class="note" role="note">These are not guaranteed to be unique. </p>
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-getattribute">getAttribute(<var>name</var>)<a class="self-link" href="#dom-element-getattribute"></a></dfn> method must run these steps:</p>
<ol>
<li>Let <var>attr</var> be 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>.
Expand Down Expand Up @@ -4396,6 +4400,7 @@ <h2 class="no-num heading settled" id="acks"><span class="content">Acknowledgmen
Dominique Hazaël-Massieux,
Don Jordan,
Doug Schepers,
Elliott Sprehn,
Erik Arvidsson,
Gavin Nicol,
Geoffrey Sneddon,
Expand Down Expand Up @@ -4821,6 +4826,7 @@ <h3 class="no-num heading settled" id="index-defined-here"><span class="content"
<li><a href="#concept-element-attributes-get-by-name">get an attribute by name</a><span>, in §4.8</span>
<li><a href="#concept-element-attributes-get-by-namespace">get an attribute by namespace and local name</a><span>, in §4.8</span>
<li><a href="#dom-element-getattribute">getAttribute(name)</a><span>, in §4.8</span>
<li><a href="#dom-element-getattributenames">getAttributeNames()</a><span>, in §4.8</span>
<li><a href="#dom-element-getattributenode">getAttributeNode(name)</a><span>, in §4.8</span>
<li><a href="#dom-element-getattributenodens">getAttributeNodeNS(namespace, localName)</a><span>, in §4.8</span>
<li><a href="#dom-element-getattributens">getAttributeNS(namespace, localName)</a><span>, in §4.8</span>
Expand Down Expand Up @@ -5832,6 +5838,7 @@ <h2 class="no-num heading settled" id="idl-index"><span class="content">IDL Inde

boolean <a class="idl-code" data-link-type="method" href="#dom-element-hasattributes">hasAttributes</a>();
[SameObject] readonly attribute <a data-link-type="idl-name" href="#namednodemap">NamedNodeMap</a> <a class="idl-code" data-link-type="attribute" data-readonly="" data-type="NamedNodeMap " href="#dom-element-attributes">attributes</a>;
sequence&lt;DOMString> <a class="idl-code" data-link-type="method" href="#dom-element-getattributenames">getAttributeNames</a>();
DOMString? <a class="idl-code" data-link-type="method" href="#dom-element-getattribute">getAttribute</a>(DOMString <a href="#dom-element-getattribute-name-name">name</a>);
DOMString? <a class="idl-code" data-link-type="method" href="#dom-element-getattributens">getAttributeNS</a>(DOMString? <a href="#dom-element-getattributens-namespace-localname-namespace">namespace</a>, DOMString <a href="#dom-element-getattributens-namespace-localname-localname">localName</a>);
void <a class="idl-code" data-link-type="method" href="#dom-element-setattribute">setAttribute</a>(DOMString <a href="#dom-element-setattribute-name-value-name">name</a>, DOMString <a href="#dom-element-setattribute-name-value-value">value</a>);
Expand Down

0 comments on commit fb45d52

Please sign in to comment.