Skip to content

Commit

Permalink
Fix #141 (again): omit non-lowercase property names from NamedNodeMap…
Browse files Browse the repository at this point in the history
… in HTML

If an HTML element somehow ends up with non-lowercase attribute
qualified names, those should not appear as property names since
although we could enumerate them, you could never get to them as the
property name would first be lowercased.
  • Loading branch information
annevk committed Jan 7, 2016
1 parent 253a21b commit 8898ac5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
29 changes: 24 additions & 5 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -5752,11 +5752,30 @@ when invoked, must run these steps:
</ol>

<p>A {{NamedNodeMap}} object's <a>supported property names</a>, all <a>unenumerable</a>, are the
<a for=Attr>qualified names</a> of the <a>attributes</a> in the
<a for=NamedNodeMap>attribute list</a>, with duplicates omitted, in order.
<!-- Even though not all names that map to an attribute are listed, due to lowercasing, ECMAScript
invariants are not violated. https://github.com/whatwg/dom/issues/141#issuecomment-168753410
has details. -->
return value of running these steps:

<ol>
<li><p>Let <var>names</var> be the <a for=Attr>qualified names</a> of the <a>attributes</a> in this
{{NamedNodeMap}} object's <a for=NamedNodeMap>attribute list</a>, with duplicates omitted, in
order.
<!-- Even though not all names that map to an attribute are listed, due to lowercasing, ECMAScript
invariants are not violated. https://github.com/whatwg/dom/issues/141#issuecomment-168753410
has details. -->

<li>
<p>If this {{NamedNodeMap}} object's <a for=NamedNodeMap>element</a> is in the
<a>HTML namespace</a> and its <a>node document</a> is an <a>HTML document</a>, then for each
<var>name</var> in <var>names</var>, run these substeps:

<ol>
<li><p>Let <var>lowercaseName</var> be <var>name</var>, <a>converted to ASCII lowercase</a>.

<li><p>If <var>lowercaseName</var> is not equal to <var>name</var>, remove <var>name</var> from
<var>names</var>.
</ol>

<li><p>Return <var>names</var>.
</ol>

The <dfn method for="NamedNodeMap"><code>getNamedItem(<var>qualifiedName</var>)</code></dfn>
method, when invoked, must return the result of
Expand Down
20 changes: 18 additions & 2 deletions 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="2016-01-06">6 January 2016</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="2016-01-07">7 January 2016</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>Participate:
Expand Down Expand Up @@ -3073,7 +3073,23 @@ <h4 class="heading settled" data-level="4.8.1" id="interface-namednodemap"><span
<li>If <var>index</var> is equal to or greater than the number of <a data-link-type="dfn" href="#concept-attribute">attributes</a> in the <a data-link-type="dfn" href="#concept-namednodemap-attribute">attribute list</a>, return null.
<li>Otherwise, return the <var>index</var>th <a data-link-type="dfn" href="#concept-attribute">attribute</a> in the <a data-link-type="dfn" href="#concept-namednodemap-attribute">attribute list</a>.
</ol>
<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>, with duplicates omitted, in order. </p>
<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
return value of running these steps: </p>
<ol>
<li>
<p>Let <var>names</var> be 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 this <code class="idl"><a data-link-type="idl" href="#namednodemap">NamedNodeMap</a></code> object’s <a data-link-type="dfn" href="#concept-namednodemap-attribute">attribute list</a>, with duplicates omitted, in
order. </p>
<li>
<p>If this <code class="idl"><a data-link-type="idl" href="#namednodemap">NamedNodeMap</a></code> object’s <a data-link-type="dfn" href="#concept-namednodemap-element">element</a> is in the <a data-link-type="dfn" href="#html-namespace">HTML namespace</a> and its <a data-link-type="dfn" href="#concept-node-document">node document</a> is an <a data-link-type="dfn" href="#html-document">HTML document</a>, then for each <var>name</var> in <var>names</var>, run these substeps: </p>
<ol>
<li>
<p>Let <var>lowercaseName</var> be <var>name</var>, <a data-link-type="dfn" href="#converted-to-ascii-lowercase">converted to ASCII lowercase</a>. </p>
<li>
<p>If <var>lowercaseName</var> is not equal to <var>name</var>, remove <var>name</var> from <var>names</var>. </p>
</ol>
<li>
<p>Return <var>names</var>. </p>
</ol>
<p>The <dfn class="idl-code" data-dfn-for="NamedNodeMap" data-dfn-type="method" data-export="" id="dom-namednodemap-getnameditem"><code>getNamedItem(<var>qualifiedName</var>)</code><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>qualifiedName</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"><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>
Expand Down

0 comments on commit 8898ac5

Please sign in to comment.