[html5] r824 - /
whatwg at whatwg.org
whatwg at whatwg.org
Wed May 16 22:32:18 PDT 2007
Author: ianh
Date: 2007-05-16 22:32:17 -0700 (Wed, 16 May 2007)
New Revision: 824
Modified:
index
source
Log:
[] (0) Added element.classList.toggle('foo') support.
Modified: index
===================================================================
--- index 2007-05-17 04:18:01 UTC (rev 823)
+++ index 2007-05-17 05:32:17 UTC (rev 824)
@@ -2946,6 +2946,7 @@
boolean <a href="#hastoken" title=dom-tokenlist-has>has</a>(in DOMString token);
void <a href="#remove" title=dom-tokenlist-add>add</a>(in DOMString token);
void <span title=dom-tokenlist-remove>remove</span>(in DOMString token);
+ boolean <a href="#toggle" title=dom-tokenlist-toggle>toggle</a>(in DOMString token);
};</pre>
<p>The <dfn id=hastoken title=dom-tokenlist-has><code>has(<var
@@ -3009,6 +3010,37 @@
string</a>.
</ol>
+ <p>The <dfn id=toggle title=dom-tokenlist-toggle><code>toggle(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:
+
+ <ol>
+ <li>If the <var title="">token</var> argument contains any
+ spaces<!-- XXX elaborate -->, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+
+ <li>Otherwise, <a href="#split" title="split a string on spaces">split the
+ underlying string on spaces</a> to get the list of tokens in the object's
+ underlying string.
+
+ <li>If the given <var title="">token</var> is already one of the tokens in
+ the <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
+ underlying string then <a href="#remove0" title="remove a token from a
+ string">remove the given <var title="">token</var> from the underlying
+ string</a>, and stop the algorithm, returning false.
+
+ <li>Otherwise, if the last character of the <code><a
+ href="#domtokenlist0">DOMTokenList</a></code> object's underlying string
+ is not a <a href="#space">space character</a>, then append a U+0020 SPACE
+ character to the end of that string.
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
+ underlying string.
+
+ <li>Return true.
+ </ol>
+
<p>In the ECMAScript DOM binding, objects implementing the <code><a
href="#domtokenlist0">DOMTokenList</a></code> interface must stringify to
the object's underlying string representation.
Modified: source
===================================================================
--- source 2007-05-17 04:18:01 UTC (rev 823)
+++ source 2007-05-17 05:32:17 UTC (rev 824)
@@ -1497,6 +1497,7 @@
boolean <span title="dom-tokenlist-has">has</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);
};</pre>
<p>The <dfn title="dom-tokenlist-has"><code>has(<var
@@ -1568,6 +1569,39 @@
</ol>
+ <p>The <dfn title="dom-tokenlist-toggle"><code>toggle(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol>
+
+ <li>If the <var title="">token</var> argument contains any
+ spaces<!-- XXX elaborate -->, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <span title="split a string on spaces">split the
+ underlying string on spaces</span> to get the list of tokens in the
+ object's underlying string.</li>
+
+ <li>If the given <var title="">token</var> is already one of the
+ tokens in the <code>DOMTokenList</code> object's underlying string
+ then <span title="remove a token from a string">remove the given
+ <var title="">token</var> from the underlying string</span>, and
+ stop the algorithm, returning false.</li>
+
+ <li>Otherwise, if the last character of the
+ <code>DOMTokenList</code> object's underlying string is not a
+ <span>space character</span>, then append a U+0020 SPACE character
+ to the end of that string.</li>
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code>DOMTokenList</code> object's underlying string.</li>
+
+ <li>Return true.</li>
+
+ </ol>
+
<p>In the ECMAScript DOM binding, objects implementing the
<code>DOMTokenList</code> interface must stringify to the object's
underlying string representation.</p>
More information about the Commit-Watchers
mailing list