[html5] r3255 - [] (0) Rename DOMTokenList.has() to .contains() for consistency with DOMStringList.
whatwg at whatwg.org
whatwg at whatwg.org
Mon Jun 15 12:26:55 PDT 2009
Author: ianh
Date: 2009-06-15 12:26:53 -0700 (Mon, 15 Jun 2009)
New Revision: 3255
Modified:
index
source
Log:
[] (0) Rename DOMTokenList.has() to .contains() for consistency with DOMStringList.
Modified: index
===================================================================
--- index 2009-06-15 19:24:03 UTC (rev 3254)
+++ index 2009-06-15 19:26:53 UTC (rev 3255)
@@ -5695,7 +5695,7 @@
<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);
@@ -5713,7 +5713,7 @@
<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>
@@ -5731,13 +5731,13 @@
<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 -->
@@ -5763,7 +5763,7 @@
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
@@ -6057,7 +6057,7 @@
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
@@ -40212,7 +40212,7 @@
<pre>function getItems(type) {
var result = [];
for (var i = 0; i < 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;
@@ -42350,7 +42350,7 @@
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.');
Modified: source
===================================================================
--- source 2009-06-15 19:24:03 UTC (rev 3254)
+++ source 2009-06-15 19:26:53 UTC (rev 3255)
@@ -5478,7 +5478,7 @@
<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);
@@ -5498,7 +5498,7 @@
<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>
@@ -5516,13 +5516,13 @@
<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 -->
@@ -5558,7 +5558,7 @@
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>
@@ -5902,7 +5902,7 @@
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
@@ -45242,7 +45242,7 @@
<pre>function getItems(type) {
var result = [];
for (var i = 0; i < 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;
@@ -47790,7 +47790,7 @@
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.');
More information about the Commit-Watchers
mailing list