Skip to content

Commit

Permalink
Remove getElementById from Element. https://www.w3.org/Bugs/Public/sh…
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Nov 26, 2013
1 parent 041f23c commit f71d7de
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 56 deletions.
56 changes: 36 additions & 20 deletions Overview.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,37 @@ <h4>Mutation algorithms</h4>
</ol>


<h4>Interface <code>NonElementParentNode</code></h4>

<p class="note no-backref">The
<code title=dom-NonElementParentNode-getElementById>getElementById()</code> method is not
on <span title=concept-element>elements</span> for compatibility with older versions of
jQuery. If a time comes where that version of jQuery has disappeared, we might be able to
support it.

This comment has been minimized.

Copy link
@rwaldron

rwaldron Nov 26, 2013

According to jQuery's own CDN request logs, the version that causes this issue was requested 6,952 times out of 34,201,901 valid requests jQuery.


<pre class=idl>[NoInterfaceObject]
interface <dfn>NonElementParentNode</dfn> {
<span>Element</span>? <span title=dom-NonElementParentNode-getElementById>getElementById</span>(DOMString <var title>elementId</var>);
};
<span>Document</span> implements <span>ParentNode</span>;
<span>DocumentFragment</span> implements <span>ParentNode</span>;</pre>

<dl class=domintro>
<dt><code><var title>node</var> . <span title=dom-NonElementParentNode-getElementById>getElementById</span>(<var title>elementId</var>)</code>
<dd><p>Returns the first <span title=concept-element>element</span> within
<var title>node</var>'s <span title=concept-tree-descendant>descendants</span> whose
<span title=concept-id>ID</span> is <var title>elementId</var>.
</dl>

<p>The
<dfn title=dom-NonElementParentNode-getElementById><code>getElementById(<var>elementId</var>)</code></dfn>
method must return the first <span title=concept-element>element</span>, in
<span title=concept-tree-order>tree order</span>, within <span>context object</span>'s
<span title=concept-tree-descendant>descendants</span>, whose
<span title=concept-ID>ID</span> is <var title>elementId</var>, and null if there is no
such <span title=concept-element>element</span> otherwise.


<h4>Interface <code>ParentNode</code></h4>

<p>The <dfn>mutation method macro</dfn>:
Expand Down Expand Up @@ -1961,7 +1992,6 @@ <h4>Interface <code>ParentNode</code></h4>
void <span title=dom-ParentNode-prepend>prepend</span>((<span>Node</span> or DOMString)... <var title>nodes</var>);
void <span title=dom-ParentNode-append>append</span>((<span>Node</span> or DOMString)... <var title>nodes</var>);

<span>Element</span>? <span title=dom-ParentNode-getElementById>getElementById</span>(DOMString <var title>elementId</var>);
<span>Element</span>? <span title=dom-ParentNode-query>query</span>(DOMString <var title>relativeSelectors</var>);
[NewObject] <span>Elements</span> <span title=dom-ParentNode-queryAll>queryAll</span>(DOMString <var title>relativeSelectors</var>);
<span>Element</span>? <span title=dom-ParentNode-querySelector>querySelector</span>(DOMString <var title>selectors</var>);
Expand Down Expand Up @@ -2010,11 +2040,6 @@ <h4>Interface <code>ParentNode</code></h4>
<span title=concept-node-tree>node tree</span> are violated.
<!-- "NotFoundError" is impossible -->

<dt><code><var title>node</var> . <span title=dom-ParentNode-getElementById>getElementById</span>(<var title>elementId</var>)</code>
<dd><p>Returns the first <span title=concept-element>element</span> within
<var title>node</var>'s <span title=concept-tree-descendant>descendants</span> whose
<span title=concept-id>ID</span> is <var title>elementId</var>.

<dt><code><var title>node</var> . <span title=dom-ParentNode-query>query</span>(<var title>relativeSelectors</var>)</code>
<dd>
<p>Returns the first <span title=concept-element>element</span> that is a
Expand Down Expand Up @@ -2088,14 +2113,6 @@ <h4>Interface <code>ParentNode</code></h4>
<var title>node</var> to the <span>context object</span>.
</ol>

<p>The
<dfn title=dom-ParentNode-getElementById><code>getElementById(<var>elementId</var>)</code></dfn>
method must return the first <span title=concept-element>element</span>, in
<span title=concept-tree-order>tree order</span>, within <span>context object</span>'s
<span title=concept-tree-descendant>descendants</span>, whose
<span title=concept-ID>ID</span> is <var title>elementId</var>, and null if there is no
such <span title=concept-element>element</span> otherwise.

<p>To <dfn>evaluate a relative selectors string</dfn> <var title>relativeSelectors</var>
against a <var title>node</var> or a <var title>list</var>, run these steps:

Expand Down Expand Up @@ -2169,13 +2186,12 @@ <h4>Interface <code>ParentNode</code></h4>

<h4>Interface <code>NonDocumentTypeChildNode</code></h4>

<p class=note>The
<p class="note no-backref">The
<code title=dom-NonDocumentTypeChildNode-previousElementSibling>previousElementSibling</code>
and
<code title=dom-NonDocumentTypeChildNode-nextElementSibling>nextElementSibling</code>
attributes have been removed from <code>DocumentType</code> nodes for
web-compatibility reasons. If these additions are deemed web-compatible
enough in the future, they could be reinstated.
and <code title=dom-NonDocumentTypeChildNode-nextElementSibling>nextElementSibling</code>
attributes have been removed from <code>DocumentType</code> nodes for compatibility
reasons. If these additions are deemed compatible enough in the future, they could be
reinstated.

<pre class=idl>[NoInterfaceObject]
interface <dfn>NonDocumentTypeChildNode</dfn> {
Expand Down
89 changes: 53 additions & 36 deletions dom-core.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<p><a class="logo" href="//www.whatwg.org/"><img alt="WHATWG" height="100" src="//resources.whatwg.org/logo-dom.svg" width="100"></a></p>

<h1>DOM</h1>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-20-november-2013">Living Standard — Last Updated 20 November 2013</h2>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-26-november-2013">Living Standard — Last Updated 26 November 2013</h2>

<dl>
<dt>This Version:
Expand Down Expand Up @@ -45,7 +45,7 @@ <h2 class="no-num no-toc" id="living-standard-—-last-updated-20-november-2013"
<p class="copyright"><a href="http://creativecommons.org/publicdomain/zero/1.0/" rel="license"><img alt="CC0" src="http://i.creativecommons.org/p/zero/1.0/80x15.png"></a>
To the extent possible under law, the editors have waived all copyright and
related or neighboring rights to this work. In addition, as of
20 November 2013, the editors have made this specification available
26 November 2013, the editors have made this specification available
under the
<a href="http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0" rel="license">Open Web Foundation Agreement Version 1.0</a>,
which is available at
Expand Down Expand Up @@ -98,14 +98,15 @@ <h2 class="no-num no-toc" id="table-of-contents">Table of Contents</h2>
<li><a href="#node-tree"><span class="secno">6.2 </span>Node tree</a>
<ol>
<li><a href="#mutation-algorithms"><span class="secno">6.2.1 </span>Mutation algorithms</a></li>
<li><a href="#interface-parentnode"><span class="secno">6.2.2 </span>Interface <code>ParentNode</code></a></li>
<li><a href="#interface-nondocumenttypechildnode"><span class="secno">6.2.3 </span>Interface <code>NonDocumentTypeChildNode</code></a></li>
<li><a href="#interface-childnode"><span class="secno">6.2.4 </span>Interface <code>ChildNode</code></a></li>
<li><a href="#collections:-elements"><span class="secno">6.2.5 </span>Collections: <code>Elements</code></a></li>
<li><a href="#old-style-collections:-nodelist-and-htmlcollection"><span class="secno">6.2.6 </span>Old-style collections: <code>NodeList</code> and <code>HTMLCollection</code></a>
<li><a href="#interface-nonelementparentnode"><span class="secno">6.2.2 </span>Interface <code>NonElementParentNode</code></a></li>
<li><a href="#interface-parentnode"><span class="secno">6.2.3 </span>Interface <code>ParentNode</code></a></li>
<li><a href="#interface-nondocumenttypechildnode"><span class="secno">6.2.4 </span>Interface <code>NonDocumentTypeChildNode</code></a></li>
<li><a href="#interface-childnode"><span class="secno">6.2.5 </span>Interface <code>ChildNode</code></a></li>
<li><a href="#collections:-elements"><span class="secno">6.2.6 </span>Collections: <code>Elements</code></a></li>
<li><a href="#old-style-collections:-nodelist-and-htmlcollection"><span class="secno">6.2.7 </span>Old-style collections: <code>NodeList</code> and <code>HTMLCollection</code></a>
<ol>
<li><a href="#interface-nodelist"><span class="secno">6.2.6.1 </span>Interface <code>NodeList</code></a></li>
<li><a href="#interface-htmlcollection"><span class="secno">6.2.6.2 </span>Interface <code>HTMLCollection</code></a></ol></ol></li>
<li><a href="#interface-nodelist"><span class="secno">6.2.7.1 </span>Interface <code>NodeList</code></a></li>
<li><a href="#interface-htmlcollection"><span class="secno">6.2.7.2 </span>Interface <code>HTMLCollection</code></a></ol></ol></li>
<li><a href="#mutation-observers"><span class="secno">6.3 </span>Mutation observers</a>
<ol>
<li><a href="#interface-mutationobserver"><span class="secno">6.3.1 </span>Interface <code>MutationObserver</code></a></li>
Expand Down Expand Up @@ -2007,7 +2008,38 @@ <h4 id="mutation-algorithms"><span class="secno">6.2.1 </span>Mutation algorithm
</ol>


<h4 id="interface-parentnode"><span class="secno">6.2.2 </span>Interface <code><a href="#parentnode">ParentNode</a></code></h4>
<h4 id="interface-nonelementparentnode"><span class="secno">6.2.2 </span>Interface <code><a href="#nonelementparentnode">NonElementParentNode</a></code></h4>

<p class="note no-backref">The
<code title="dom-NonElementParentNode-getElementById"><a href="#dom-nonelementparentnode-getelementbyid">getElementById()</a></code> method is not
on <a href="#concept-element" title="concept-element">elements</a> for compatibility with older versions of
jQuery. If a time comes where that version of jQuery has disappeared, we might be able to
support it.

<pre class="idl">[NoInterfaceObject]
interface <dfn id="nonelementparentnode">NonElementParentNode</dfn> {
<a href="#element">Element</a>? <a href="#dom-nonelementparentnode-getelementbyid" title="dom-NonElementParentNode-getElementById">getElementById</a>(DOMString <var title="">elementId</var>);
};
<a href="#document">Document</a> implements <a href="#parentnode">ParentNode</a>;
<a href="#documentfragment">DocumentFragment</a> implements <a href="#parentnode">ParentNode</a>;</pre>

<dl class="domintro">
<dt><code><var title="">node</var> . <a href="#dom-nonelementparentnode-getelementbyid" title="dom-NonElementParentNode-getElementById">getElementById</a>(<var title="">elementId</var>)</code>
<dd><p>Returns the first <a href="#concept-element" title="concept-element">element</a> within
<var title="">node</var>'s <a href="#concept-tree-descendant" title="concept-tree-descendant">descendants</a> whose
<a href="#concept-id" title="concept-id">ID</a> is <var title="">elementId</var>.
</dl>

<p>The
<dfn id="dom-nonelementparentnode-getelementbyid" title="dom-NonElementParentNode-getElementById"><code>getElementById(<var>elementId</var>)</code></dfn>
method must return the first <a href="#concept-element" title="concept-element">element</a>, in
<a href="#concept-tree-order" title="concept-tree-order">tree order</a>, within <a href="#context-object">context object</a>'s
<a href="#concept-tree-descendant" title="concept-tree-descendant">descendants</a>, whose
<a href="#concept-id" title="concept-ID">ID</a> is <var title="">elementId</var>, and null if there is no
such <a href="#concept-element" title="concept-element">element</a> otherwise.


<h4 id="interface-parentnode"><span class="secno">6.2.3 </span>Interface <code><a href="#parentnode">ParentNode</a></code></h4>

<p>The <dfn id="mutation-method-macro">mutation method macro</dfn>:

Expand Down Expand Up @@ -2040,7 +2072,6 @@ <h4 id="interface-parentnode"><span class="secno">6.2.2 </span>Interface <code><
void <a href="#dom-parentnode-prepend" title="dom-ParentNode-prepend">prepend</a>((<a href="#node">Node</a> or DOMString)... <var title="">nodes</var>);
void <a href="#dom-parentnode-append" title="dom-ParentNode-append">append</a>((<a href="#node">Node</a> or DOMString)... <var title="">nodes</var>);

<a href="#element">Element</a>? <a href="#dom-parentnode-getelementbyid" title="dom-ParentNode-getElementById">getElementById</a>(DOMString <var title="">elementId</var>);
<a href="#element">Element</a>? <a href="#dom-parentnode-query" title="dom-ParentNode-query">query</a>(DOMString <var title="">relativeSelectors</var>);
[NewObject] <a href="#elements">Elements</a> <a href="#dom-parentnode-queryall" title="dom-ParentNode-queryAll">queryAll</a>(DOMString <var title="">relativeSelectors</var>);
<a href="#element">Element</a>? <a href="#dom-parentnode-queryselector" title="dom-ParentNode-querySelector">querySelector</a>(DOMString <var title="">selectors</var>);
Expand Down Expand Up @@ -2089,11 +2120,6 @@ <h4 id="interface-parentnode"><span class="secno">6.2.2 </span>Interface <code><
<a href="#concept-node-tree" title="concept-node-tree">node tree</a> are violated.
<!-- "NotFoundError" is impossible -->

<dt><code><var title="">node</var> . <a href="#dom-parentnode-getelementbyid" title="dom-ParentNode-getElementById">getElementById</a>(<var title="">elementId</var>)</code>
<dd><p>Returns the first <a href="#concept-element" title="concept-element">element</a> within
<var title="">node</var>'s <a href="#concept-tree-descendant" title="concept-tree-descendant">descendants</a> whose
<a href="#concept-id" title="concept-id">ID</a> is <var title="">elementId</var>.

<dt><code><var title="">node</var> . <a href="#dom-parentnode-query" title="dom-ParentNode-query">query</a>(<var title="">relativeSelectors</var>)</code>
<dd>
<p>Returns the first <a href="#concept-element" title="concept-element">element</a> that is a
Expand Down Expand Up @@ -2167,14 +2193,6 @@ <h4 id="interface-parentnode"><span class="secno">6.2.2 </span>Interface <code><
<var title="">node</var> to the <a href="#context-object">context object</a>.
</ol>

<p>The
<dfn id="dom-parentnode-getelementbyid" title="dom-ParentNode-getElementById"><code>getElementById(<var>elementId</var>)</code></dfn>
method must return the first <a href="#concept-element" title="concept-element">element</a>, in
<a href="#concept-tree-order" title="concept-tree-order">tree order</a>, within <a href="#context-object">context object</a>'s
<a href="#concept-tree-descendant" title="concept-tree-descendant">descendants</a>, whose
<a href="#concept-id" title="concept-ID">ID</a> is <var title="">elementId</var>, and null if there is no
such <a href="#concept-element" title="concept-element">element</a> otherwise.

<p>To <dfn id="evaluate-a-relative-selectors-string">evaluate a relative selectors string</dfn> <var title="">relativeSelectors</var>
against a <var title="">node</var> or a <var title="">list</var>, run these steps:

Expand Down Expand Up @@ -2246,15 +2264,14 @@ <h4 id="interface-parentnode"><span class="secno">6.2.2 </span>Interface <code><
<a href="#context-object">context object</a>.


<h4 id="interface-nondocumenttypechildnode"><span class="secno">6.2.3 </span>Interface <code><a href="#nondocumenttypechildnode">NonDocumentTypeChildNode</a></code></h4>
<h4 id="interface-nondocumenttypechildnode"><span class="secno">6.2.4 </span>Interface <code><a href="#nondocumenttypechildnode">NonDocumentTypeChildNode</a></code></h4>

<p class="note">The
<p class="note no-backref">The
<code title="dom-NonDocumentTypeChildNode-previousElementSibling"><a href="#dom-nondocumenttypechildnode-previouselementsibling">previousElementSibling</a></code>
and
<code title="dom-NonDocumentTypeChildNode-nextElementSibling"><a href="#dom-nondocumenttypechildnode-nextelementsibling">nextElementSibling</a></code>
attributes have been removed from <code><a href="#documenttype">DocumentType</a></code> nodes for
web-compatibility reasons. If these additions are deemed web-compatible
enough in the future, they could be reinstated.
and <code title="dom-NonDocumentTypeChildNode-nextElementSibling"><a href="#dom-nondocumenttypechildnode-nextelementsibling">nextElementSibling</a></code>
attributes have been removed from <code><a href="#documenttype">DocumentType</a></code> nodes for compatibility
reasons. If these additions are deemed compatible enough in the future, they could be
reinstated.

<pre class="idl">[NoInterfaceObject]
interface <dfn id="nondocumenttypechildnode">NonDocumentTypeChildNode</dfn> {
Expand Down Expand Up @@ -2293,7 +2310,7 @@ <h4 id="interface-nondocumenttypechildnode"><span class="secno">6.2.3 </span>Int
<a href="#concept-element" title="concept-element">element</a>, and null otherwise.


<h4 id="interface-childnode"><span class="secno">6.2.4 </span>Interface <code><a href="#childnode">ChildNode</a></code></h4>
<h4 id="interface-childnode"><span class="secno">6.2.5 </span>Interface <code><a href="#childnode">ChildNode</a></code></h4>

<pre class="idl">[NoInterfaceObject]
interface <dfn id="childnode">ChildNode</dfn> {
Expand Down Expand Up @@ -2405,7 +2422,7 @@ <h4 id="interface-childnode"><span class="secno">6.2.4 </span>Interface <code><a
</ol>


<h4 id="collections:-elements"><span class="secno">6.2.5 </span>Collections: <code><a href="#elements">Elements</a></code></h4>
<h4 id="collections:-elements"><span class="secno">6.2.6 </span>Collections: <code><a href="#elements">Elements</a></code></h4>

<pre class="idl">class <dfn id="elements">Elements</dfn> extends <span>Array</span> {
<a href="#element">Element</a>? <a href="#dom-elements-query" title="dom-Elements-query">query</a>(DOMString <var title="">relativeSelectors</var>);
Expand Down Expand Up @@ -2446,7 +2463,7 @@ <h4 id="collections:-elements"><span class="secno">6.2.5 </span>Collections: <co
<var title="">relativeSelectors</var> against the <a href="#context-object">context object</a>.


<h4 id="old-style-collections:-nodelist-and-htmlcollection"><span class="secno">6.2.6 </span>Old-style collections: <code><a href="#nodelist">NodeList</a></code> and <code><a href="#htmlcollection">HTMLCollection</a></code></h4>
<h4 id="old-style-collections:-nodelist-and-htmlcollection"><span class="secno">6.2.7 </span>Old-style collections: <code><a href="#nodelist">NodeList</a></code> and <code><a href="#htmlcollection">HTMLCollection</a></code></h4>

<p>A <dfn id="concept-collection" title="concept-collection">collection</dfn> is an object that
represents a lists of DOM nodes. A
Expand All @@ -2472,7 +2489,7 @@ <h4 id="old-style-collections:-nodelist-and-htmlcollection"><span class="secno">
<a href="#concept-tree-order" title="concept-tree-order">tree order</a>.


<h5 id="interface-nodelist"><span class="secno">6.2.6.1 </span>Interface <code><a href="#nodelist">NodeList</a></code></h5>
<h5 id="interface-nodelist"><span class="secno">6.2.7.1 </span>Interface <code><a href="#nodelist">NodeList</a></code></h5>

<p>A <code><a href="#nodelist">NodeList</a></code> object is a
<a href="#concept-collection" title="concept-collection">collection</a> of
Expand Down Expand Up @@ -2526,7 +2543,7 @@ <h5 id="interface-nodelist"><span class="secno">6.2.6.1 </span>Interface <code><
</div>


<h5 id="interface-htmlcollection"><span class="secno">6.2.6.2 </span>Interface <code><a href="#htmlcollection">HTMLCollection</a></code></h5>
<h5 id="interface-htmlcollection"><span class="secno">6.2.7.2 </span>Interface <code><a href="#htmlcollection">HTMLCollection</a></code></h5>

<pre class="idl">interface <dfn id="htmlcollection">HTMLCollection</dfn> {
readonly attribute unsigned long <a href="#dom-htmlcollection-length" title="dom-HTMLCollection-length">length</a>;
Expand Down

0 comments on commit f71d7de

Please sign in to comment.