Skip to content

Commit

Permalink
[] (0) Rename DOMTokenList.has() to .contains() for consistency with …
Browse files Browse the repository at this point in the history
…DOMStringList.

git-svn-id: http://svn.whatwg.org/webapps@3255 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 15, 2009
1 parent 416fb7a commit e5b195f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions index
Expand Up @@ -5695,7 +5695,7 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
<pre class=idl>[<a href=#dom-tokenlist-tostring title=dom-tokenlist-toString>Stringifies</a>] interface <dfn id=domtokenlist-0>DOMTokenList</dfn> {
readonly attribute unsigned long <a href=#dom-tokenlist-length title=dom-tokenlist-length>length</a>;
[IndexGetter] DOMString <a href=#dom-tokenlist-item title=dom-tokenlist-item>item</a>(in unsigned long index);
boolean <a href=#dom-tokenlist-has title=dom-tokenlist-has>has</a>(in DOMString token);
boolean <a href=#dom-tokenlist-contains title=dom-tokenlist-contains>contains</a>(in DOMString token);
void <a href=#dom-tokenlist-add title=dom-tokenlist-add>add</a>(in DOMString token);
void <a href=#dom-tokenlist-remove title=dom-tokenlist-remove>remove</a>(in DOMString token);
boolean <a href=#dom-tokenlist-toggle title=dom-tokenlist-toggle>toggle</a>(in DOMString token);
Expand All @@ -5713,7 +5713,7 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
<p>Returns null if <var title="">index</var> is out of range.</p>
</dd>

<dt><var title="">has-p</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-has><a href=#dom-tokenlist-has>has</a></code>(<var title="">token</var>)</dt>
<dt><var title="">contains-p</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-contains><a href=#dom-tokenlist-contains>contains</a></code>(<var title="">token</var>)</dt>
<dd>
<p>Returns true if the <var title="">token</var> is present; false otherwise.</p>
<p>Throws an <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception if <var title="">token</var> contains any spaces.</p>
Expand All @@ -5731,13 +5731,13 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
<p>Throws an <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception if <var title="">token</var> contains any spaces.</p>
</dd>

<dt><var title="">has-p</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-toggle><a href=#dom-tokenlist-toggle>toggle</a></code>(<var title="">token</var>)</dt>
<dt><var title="">contains-p</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-toggle><a href=#dom-tokenlist-toggle>toggle</a></code>(<var title="">token</var>)</dt>
<dd>
<p>Adds <var title="">token</var> if it is not present, or removes it if it is.</p>
<p>Throws an <code><a href=#invalid_character_err>INVALID_CHARACTER_ERR</a></code> exception if <var title="">token</var> contains any spaces.</p>
</dd>

<!-- eventually someone will complain about the has-p variable
<!-- eventually someone will complain about the contains-p variable
names above, and we'll replace them with something better that they
suggest -->

Expand All @@ -5763,7 +5763,7 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
a c</code>" then there are three tokens: the token with index 0 is
"<code title="">a</code>", the token with index 1 is "<code title="">b</code>", and the token with index 2 is "<code title="">c</code>".</p>

<p>The <dfn id=dom-tokenlist-has title=dom-tokenlist-has><code>has(<var title="">token</var>)</code></dfn> method must run the following
<p>The <dfn id=dom-tokenlist-contains title=dom-tokenlist-contains><code>contains(<var title="">token</var>)</code></dfn> method must run the following
algorithm:</p>

<ol><li>If the <var title="">token</var> argument contains any <a href=#space-character title="space character">space characters</a>, then raise an
Expand Down Expand Up @@ -6057,7 +6057,7 @@ interface <dfn id=domstringmap-0>DOMStringMap</dfn> {};</pre>
of which is the element to process:</p>

<pre>function splashDamage(node, x, y, damage) {
if (node.classList.has('tower') &amp;&amp; // checking the 'class' attribute
if (node.classList.contains('tower') &amp;&amp; // checking the 'class' attribute
node.dataset.x == x &amp;&amp; // reading the 'data-x' attribute
node.dataset.y == y) { // reading the 'data-y' attribute
var hp = parseInt(node.dataset.hp); // reading the 'data-hp' attribute
Expand Down Expand Up @@ -40212,7 +40212,7 @@ explain that only direct children of the <menu> matter
<pre>function getItems(type) {
var result = [];
for (var i = 0; i &lt; document.items.length; i += 1) {
if (document.items[i].item.has(type))
if (document.items[i].item.contains(type))
result.push(document.items[i]);
}
return result;
Expand Down Expand Up @@ -42350,7 +42350,7 @@ document.body.appendChild(outer);</pre>
this:</p>

<pre>function getCalendar(node) {
while (node &amp;&amp; !node.item.has('vevent'))
while (node &amp;&amp; !node.item.contains('vevent'))
node = node.parentNode;
if (!node) {
alert('No event data found.');
Expand Down
16 changes: 8 additions & 8 deletions source
Expand Up @@ -5478,7 +5478,7 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
<pre class="idl">[<span title="dom-tokenlist-toString">Stringifies</span>] interface <dfn>DOMTokenList</dfn> {
readonly attribute unsigned long <span title="dom-tokenlist-length">length</span>;
[IndexGetter] DOMString <span title="dom-tokenlist-item">item</span>(in unsigned long index);
boolean <span title="dom-tokenlist-has">has</span>(in DOMString token);
boolean <span title="dom-tokenlist-contains">contains</span>(in DOMString token);
void <span title="dom-tokenlist-add">add</span>(in DOMString token);
void <span title="dom-tokenlist-remove">remove</span>(in DOMString token);
boolean <span title="dom-tokenlist-toggle">toggle</span>(in DOMString token);
Expand All @@ -5498,7 +5498,7 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
<p>Returns null if <var title="">index</var> is out of range.</p>
</dd>

<dt><var title="">has-p</var> = <var title="">tokenlist</var> . <code title="dom-tokenlist-has">has</code>(<var title="">token</var>)</dt>
<dt><var title="">contains-p</var> = <var title="">tokenlist</var> . <code title="dom-tokenlist-contains">contains</code>(<var title="">token</var>)</dt>
<dd>
<p>Returns true if the <var title="">token</var> is present; false otherwise.</p>
<p>Throws an <code>INVALID_CHARACTER_ERR</code> exception if <var title="">token</var> contains any spaces.</p>
Expand All @@ -5516,13 +5516,13 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
<p>Throws an <code>INVALID_CHARACTER_ERR</code> exception if <var title="">token</var> contains any spaces.</p>
</dd>

<dt><var title="">has-p</var> = <var title="">tokenlist</var> . <code title="dom-tokenlist-toggle">toggle</code>(<var title="">token</var>)</dt>
<dt><var title="">contains-p</var> = <var title="">tokenlist</var> . <code title="dom-tokenlist-toggle">toggle</code>(<var title="">token</var>)</dt>
<dd>
<p>Adds <var title="">token</var> if it is not present, or removes it if it is.</p>
<p>Throws an <code>INVALID_CHARACTER_ERR</code> exception if <var title="">token</var> contains any spaces.</p>
</dd>

<!-- eventually someone will complain about the has-p variable
<!-- eventually someone will complain about the contains-p variable
names above, and we'll replace them with something better that they
suggest -->

Expand Down Expand Up @@ -5558,7 +5558,7 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
title="">b</code>", and the token with index 2 is "<code
title="">c</code>".</p>

<p>The <dfn title="dom-tokenlist-has"><code>has(<var
<p>The <dfn title="dom-tokenlist-contains"><code>contains(<var
title="">token</var>)</code></dfn> method must run the following
algorithm:</p>

Expand Down Expand Up @@ -5902,7 +5902,7 @@ interface <dfn>DOMStringMap</dfn> {};</pre>
of which is the element to process:</p>

<pre>function splashDamage(node, x, y, damage) {
if (node.classList.has('tower') && // checking the 'class' attribute
if (node.classList.contains('tower') && // checking the 'class' attribute
node.dataset.x == x && // reading the 'data-x' attribute
node.dataset.y == y) { // reading the 'data-y' attribute
var hp = parseInt(node.dataset.hp); // reading the 'data-hp' attribute
Expand Down Expand Up @@ -45242,7 +45242,7 @@ explain that only direct children of the <menu> matter
<pre>function getItems(type) {
var result = [];
for (var i = 0; i &lt; document.items.length; i += 1) {
if (document.items[i].item.has(type))
if (document.items[i].item.contains(type))
result.push(document.items[i]);
}
return result;
Expand Down Expand Up @@ -47790,7 +47790,7 @@ document.body.appendChild(outer);</pre>
this:</p>

<pre>function getCalendar(node) {
while (node && !node.item.has('vevent'))
while (node && !node.item.contains('vevent'))
node = node.parentNode;
if (!node) {
alert('No event data found.');
Expand Down

0 comments on commit e5b195f

Please sign in to comment.