Skip to content

Commit

Permalink
Define Element.prototype.matches()
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Sep 12, 2013
1 parent a6d165f commit 138a7d3
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 22 deletions.
36 changes: 26 additions & 10 deletions Overview.src.html
Expand Up @@ -5020,6 +5020,8 @@ <h3>Interface <code>Element</code></h3>
<span>Attr</span> <span title=dom-Element-setAttributeNode>setAttributeNode</span>(Attr newAttr);
<span>Attr</span> <span title=dom-Element-removeAttributeNode>removeAttributeNode</span>(Attr oldAttr);
-->
boolean <span title=dom-Element-matches>matches</span>(DOMString <var title>selectors</var>);

<span>HTMLCollection</span> <span title=dom-Element-getElementsByTagName>getElementsByTagName</span>(DOMString <var title>localName</var>);
<span>HTMLCollection</span> <span title=dom-Element-getElementsByTagNameNS>getElementsByTagNameNS</span>(DOMString? <var title>namespace</var>, DOMString <var title>localName</var>);
<span>HTMLCollection</span> <span title=dom-Element-getElementsByClassName>getElementsByClassName</span>(DOMString <var title>classNames</var>);
Expand Down Expand Up @@ -5541,18 +5543,18 @@ <h3>Interface <code>Element</code></h3>
</ol>

<p>The
<dfn title=dom-Element-hasAttributeNS><code>hasAttributeNS(<var title>namespace</var>, <var title>localName</var>)</code></dfn>
method must return the following steps:
<dfn title=dom-Element-hasAttributeNS><code>hasAttributeNS(<var>namespace</var>, <var>localName</var>)</code></dfn>
method must run these steps:

<ol>
<li><p>If <var title>namespace</var> is the empty string, set it to null.
<li><p>If <var title>namespace</var> is the empty string, set it to null.

<li><p>Return true if the <span>context object</span>
<span title=concept-element-attribute-has>has</span> an
<span title=concept-attribute>attribute</span> whose
<span title=concept-attribute-namespace>namespace</span> is
<var title>namespace</var> and
<span title=concept-attribute-local-name>local name</span> is
<var title>localName</var>, and false otherwise.
<li><p>Return true if the <span>context object</span>
<span title=concept-element-attribute-has>has</span> an
<span title=concept-attribute>attribute</span> whose
<span title=concept-attribute-namespace>namespace</span> is <var title>namespace</var>
and <span title=concept-attribute-local-name>local name</span> is
<var title>localName</var>, and false otherwise.
</ol>

<!--<dfn title=dom-Element-getAttributeNode>getAttributeNode</dfn>: when the
Expand All @@ -5567,6 +5569,20 @@ <h3>Interface <code>Element</code></h3>

<hr>

<dl class=domintro>
<dt><code><var title>element</var> . <span title=dom-Element-matches>matches</span>(<var title>selectors</var>)</code>
<dd><p>Returns true if matching <var title>selectors</var> against
<var title>element</var>'s <span title=dom-tree-root>root</span> yields
<var title>element</var>, and false otherwise.
</dl>

<p>The <dfn title=dom-Element-matches><code>matches(<var>selectors</var>)</code></dfn>
method must return true if the <span>context object</span> is in the result of running
<span>evaluate a selectors string</span> <var title>selectors</var> against the
<span>context object</span>, and false otherwise.

<hr>

<p>The
<dfn title=dom-Element-getElementsByTagName><code>getElementsByTagName(<var>localName</var>)</code></dfn>
method must return the
Expand Down
40 changes: 28 additions & 12 deletions dom-core.html
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-11-september-2013">Living Standard — Last Updated 11 September 2013</h2>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-12-september-2013">Living Standard — Last Updated 12 September 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-11-september-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
11 September 2013, the editors have made this specification available
12 September 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 @@ -5089,6 +5089,8 @@ <h3 id="interface-element"><span class="secno">6.8 </span>Interface <code><a hre
<span>Attr</span> <span title=dom-Element-setAttributeNode>setAttributeNode</span>(Attr newAttr);
<span>Attr</span> <span title=dom-Element-removeAttributeNode>removeAttributeNode</span>(Attr oldAttr);
-->
boolean <a href="#dom-element-matches" title="dom-Element-matches">matches</a>(DOMString <var title="">selectors</var>);

<a href="#htmlcollection">HTMLCollection</a> <a href="#dom-element-getelementsbytagname" title="dom-Element-getElementsByTagName">getElementsByTagName</a>(DOMString <var title="">localName</var>);
<a href="#htmlcollection">HTMLCollection</a> <a href="#dom-element-getelementsbytagnamens" title="dom-Element-getElementsByTagNameNS">getElementsByTagNameNS</a>(DOMString? <var title="">namespace</var>, DOMString <var title="">localName</var>);
<a href="#htmlcollection">HTMLCollection</a> <a href="#dom-element-getelementsbyclassname" title="dom-Element-getElementsByClassName">getElementsByClassName</a>(DOMString <var title="">classNames</var>);
Expand Down Expand Up @@ -5610,18 +5612,18 @@ <h3 id="interface-element"><span class="secno">6.8 </span>Interface <code><a hre
</ol>

<p>The
<dfn id="dom-element-hasattributens" title="dom-Element-hasAttributeNS"><code>hasAttributeNS(<var title="">namespace</var>, <var title="">localName</var>)</code></dfn>
method must return the following steps:
<dfn id="dom-element-hasattributens" title="dom-Element-hasAttributeNS"><code>hasAttributeNS(<var>namespace</var>, <var>localName</var>)</code></dfn>
method must run these steps:

<ol>
<li><p>If <var title="">namespace</var> is the empty string, set it to null.
<li><p>If <var title="">namespace</var> is the empty string, set it to null.

<li><p>Return true if the <a href="#context-object">context object</a>
<a href="#concept-element-attribute-has" title="concept-element-attribute-has">has</a> an
<a href="#concept-attribute" title="concept-attribute">attribute</a> whose
<a href="#concept-attribute-namespace" title="concept-attribute-namespace">namespace</a> is
<var title="">namespace</var> and
<a href="#concept-attribute-local-name" title="concept-attribute-local-name">local name</a> is
<var title="">localName</var>, and false otherwise.
<li><p>Return true if the <a href="#context-object">context object</a>
<a href="#concept-element-attribute-has" title="concept-element-attribute-has">has</a> an
<a href="#concept-attribute" title="concept-attribute">attribute</a> whose
<a href="#concept-attribute-namespace" title="concept-attribute-namespace">namespace</a> is <var title="">namespace</var>
and <a href="#concept-attribute-local-name" title="concept-attribute-local-name">local name</a> is
<var title="">localName</var>, and false otherwise.
</ol>

<!--<dfn title=dom-Element-getAttributeNode>getAttributeNode</dfn>: when the
Expand All @@ -5636,6 +5638,20 @@ <h3 id="interface-element"><span class="secno">6.8 </span>Interface <code><a hre

<hr>

<dl class="domintro">
<dt><code><var title="">element</var> . <a href="#dom-element-matches" title="dom-Element-matches">matches</a>(<var title="">selectors</var>)</code>
<dd><p>Returns true if matching <var title="">selectors</var> against
<var title="">element</var>'s <span title="dom-tree-root">root</span> yields
<var title="">element</var>, and false otherwise.
</dl>

<p>The <dfn id="dom-element-matches" title="dom-Element-matches"><code>matches(<var>selectors</var>)</code></dfn>
method must return true if the <a href="#context-object">context object</a> is in the result of running
<a href="#evaluate-a-selectors-string">evaluate a selectors string</a> <var title="">selectors</var> against the
<a href="#context-object">context object</a>, and false otherwise.

<hr>

<p>The
<dfn id="dom-element-getelementsbytagname" title="dom-Element-getElementsByTagName"><code>getElementsByTagName(<var>localName</var>)</code></dfn>
method must return the
Expand Down

0 comments on commit 138a7d3

Please sign in to comment.