Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make DOMTokenList add/remove support variable arity

  • Loading branch information...
commit 91fcd602fc31310aee487ebf809451195f64af9e 1 parent 68206e3
@annevk annevk authored
Showing with 80 additions and 70 deletions.
  1. +40 −35 Overview.src.html
  2. +40 −35 dom-core.html
View
75 Overview.src.html
@@ -8386,11 +8386,11 @@ <h2 class=no-num>Goals</h2>
<pre class="idl">interface <dfn>DOMTokenList</dfn> {
readonly attribute unsigned long <span title="dom-DOMTokenList-length">length</span>;
- getter DOMString? <span title="dom-DOMTokenList-item">item</span>(unsigned long index);
- boolean <span title="dom-DOMTokenList-contains">contains</span>(DOMString token);
- void <span title="dom-DOMTokenList-add">add</span>(DOMString token);
- void <span title="dom-DOMTokenList-remove">remove</span>(DOMString token);
- boolean <span title="dom-DOMTokenList-toggle">toggle</span>(DOMString token);
+ getter DOMString? <span title="dom-DOMTokenList-item">item</span>(unsigned long <var title>index</var>);
+ boolean <span title="dom-DOMTokenList-contains">contains</span>(DOMString <var title>token</var>);
+ void <span title="dom-DOMTokenList-add">add</span>(DOMString... <var title>tokens</var>);
+ void <span title="dom-DOMTokenList-remove">remove</span>(DOMString... <var title>tokens</var>);
+ boolean <span title="dom-DOMTokenList-toggle">toggle</span>(DOMString <var title>token</var>);
<span title="dom-DOMTokenList-toString">stringifier</span> DOMString ();
};</pre>
@@ -8410,17 +8410,21 @@ <h2 class=no-num>Goals</h2>
<p>Throws a "<code>SyntaxError</code>" exception if <var title>token</var> is empty.
<p>Throws an "<code>InvalidCharacterError</code>" exception if <var title>token</var> contains any spaces.
- <dt><var title>tokenlist</var> . <code title="dom-DOMTokenList-add">add</code>(<var title>token</var>)
+ <dt><code><var title>tokenlist</var> . <span title=dom-DOMTokenList-add>add</span>(<var title>tokens</var>&hellip;)</code>
<dd>
- <p>Adds <var title>token</var>, unless it is already present.
- <p>Throws a "<code>SyntaxError</code>" exception if <var title>token</var> is empty.
- <p>Throws an "<code>InvalidCharacterError</code>" exception if <var title>token</var> contains any spaces.
+ <p>Adds all arguments passed, except those already present.
+ <p>Throws a "<code>SyntaxError</code>" exception if one if the arguments
+ is the empty string.
+ <p>Throws an "<code>InvalidCharacterError</code>" exception if one of the
+ arguments contains any <span title="space character">spaces</span>.
- <dt><var title>tokenlist</var> . <code title="dom-DOMTokenList-remove">remove</code>(<var title>token</var>)
+ <dt><code><var title>tokenlist</var> . <code title=dom-DOMTokenList-remove>remove</code>(<var title>tokens</var>&hellip;)</code>
<dd>
- <p>Removes <var title>token</var> if it is present.
- <p>Throws a "<code>SyntaxError</code>" exception if <var title>token</var> is empty.
- <p>Throws an "<code>InvalidCharacterError</code>" exception if <var title>token</var> contains any spaces.
+ <p>Removes arguments passed, if they are present.
+ <p>Throws a "<code>SyntaxError</code>" exception if one if the arguments
+ is the empty string.
+ <p>Throws an "<code>InvalidCharacterError</code>" exception if one of the
+ arguments contains any <span title="space character">spaces</span>.
<dt><var title>hastoken</var> = <var title>tokenlist</var> . <code title="dom-DOMTokenList-toggle">toggle</code>(<var title>token</var>)
<dd>
@@ -8497,54 +8501,55 @@ <h2 class=no-num>Goals</h2>
</ol>
<p>The
-<dfn title="dom-DOMTokenList-add"><code>add(<var title>token</var>)</code></dfn>
+<dfn title=dom-DOMTokenList-add><code>add(<var title>tokens</var>&hellip;)</code></dfn>
method must run these steps:
<ol>
- <li>If <var title>token</var> is the empty string, then
- <span title=concept-throw>throw</span> a
- "<code>SyntaxError</code>" exception and terminate these steps.
+ <li>If one of the tokens in <var title>tokens</var> is the empty string,
+ <span title=concept-throw>throw</span> a "<code>SyntaxError</code>"
+ exception and terminate these steps.
- <li>If <var title>token</var> contains any
+ <li>If one of the tokens in <var title>tokens</var> contains any
<span title="space character">space characters</span>, then
<span title=concept-throw>throw</span> an
- "<code>InvalidCharacterError</code>" exception and terminate these
- steps.
+ "<code>InvalidCharacterError</code>" exception and terminate these steps.
<li><span title="split a string on spaces">Split</span> the
<span title=concept-tokenlist-underlying-string>underlying string</span> on
spaces to get the list of tokens.
- <li>If <var title>token</var> is a <span>case-sensitive</span> match for one of
- the tokens in the list found in the previous step, then terminate these steps.
+ <li>Remove each token in <var title>tokens</var> that is a
+ <span>case-sensitive</span> match for one of the tokens in the list found
+ in the previous step. If <var title>tokens</var> is now empty, then
+ terminate these steps.
<li>If the
- <span title=concept-tokenlist-underlying-string>underlying string</span> is not
- the empty string and the last character of that string is not a
+ <span title=concept-tokenlist-underlying-string>underlying string</span> is
+ not the empty string and the last character of that string is not a
<span>space character</span>, then append a U+0020 SPACE character to that
string.
- <li>Append <var title>token</var> to the
- <span title=concept-tokenlist-underlying-string>underlying string</span>.
+ <li>Append all tokens in <var title>tokens</var> to the
+ <span title=concept-tokenlist-underlying-string>underlying string</span>
+ separated from each other by a U+0020 SPACE character, in list order.
</ol>
<p>The
-<dfn title="dom-DOMTokenList-remove"><code>remove(<var title>token</var>)</code></dfn>
+<dfn title="dom-DOMTokenList-remove"><code>remove(<var title>tokens</var>&hellip;)</code></dfn>
method must run these steps:
<ol>
- <li>If <var title>token</var> is the empty string, then
- <span title=concept-throw>throw</span> a
- "<code>SyntaxError</code>" exception and terminate these steps.
+ <li>If one of the tokens in <var title>tokens</var> is the empty string,
+ <span title=concept-throw>throw</span> a "<code>SyntaxError</code>"
+ exception and terminate these steps.
- <li>If <var title>token</var> contains any
+ <li>If one of the tokens in <var title>tokens</var> contains any
<span title="space character">space characters</span>, then
<span title=concept-throw>throw</span> an
- "<code>InvalidCharacterError</code>" exception and terminate these
- steps.
+ "<code>InvalidCharacterError</code>" exception and terminate these steps.
- <li><span title="remove a token from a string">Remove</span>
- <var title>token</var> from the
+ <li><span title="remove a token from a string">Remove</span> each token in
+ <var title>tokens</var> from the
<span title=concept-tokenlist-underlying-string>underlying string</span>.
</ol>
View
75 dom-core.html
@@ -8392,11 +8392,11 @@ <h3 id="interface-domtokenlist"><span class="secno">9.2 </span>Interface <code><
<pre class="idl">interface <dfn id="domtokenlist">DOMTokenList</dfn> {
readonly attribute unsigned long <a href="#dom-domtokenlist-length" title="dom-DOMTokenList-length">length</a>;
- getter DOMString? <a href="#dom-domtokenlist-item" title="dom-DOMTokenList-item">item</a>(unsigned long index);
- boolean <a href="#dom-domtokenlist-contains" title="dom-DOMTokenList-contains">contains</a>(DOMString token);
- void <a href="#dom-domtokenlist-add" title="dom-DOMTokenList-add">add</a>(DOMString token);
- void <a href="#dom-domtokenlist-remove" title="dom-DOMTokenList-remove">remove</a>(DOMString token);
- boolean <a href="#dom-domtokenlist-toggle" title="dom-DOMTokenList-toggle">toggle</a>(DOMString token);
+ getter DOMString? <a href="#dom-domtokenlist-item" title="dom-DOMTokenList-item">item</a>(unsigned long <var title="">index</var>);
+ boolean <a href="#dom-domtokenlist-contains" title="dom-DOMTokenList-contains">contains</a>(DOMString <var title="">token</var>);
+ void <a href="#dom-domtokenlist-add" title="dom-DOMTokenList-add">add</a>(DOMString... <var title="">tokens</var>);
+ void <a href="#dom-domtokenlist-remove" title="dom-DOMTokenList-remove">remove</a>(DOMString... <var title="">tokens</var>);
+ boolean <a href="#dom-domtokenlist-toggle" title="dom-DOMTokenList-toggle">toggle</a>(DOMString <var title="">token</var>);
<a href="#dom-domtokenlist-tostring" title="dom-DOMTokenList-toString">stringifier</a> DOMString ();
};</pre>
@@ -8416,17 +8416,21 @@ <h3 id="interface-domtokenlist"><span class="secno">9.2 </span>Interface <code><
<p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if <var title="">token</var> is empty.
<p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if <var title="">token</var> contains any spaces.
- <dt><var title="">tokenlist</var> . <code title="dom-DOMTokenList-add"><a href="#dom-domtokenlist-add">add</a></code>(<var title="">token</var>)
+ <dt><code><var title="">tokenlist</var> . <a href="#dom-domtokenlist-add" title="dom-DOMTokenList-add">add</a>(<var title="">tokens</var>…)</code>
<dd>
- <p>Adds <var title="">token</var>, unless it is already present.
- <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if <var title="">token</var> is empty.
- <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if <var title="">token</var> contains any spaces.
+ <p>Adds all arguments passed, except those already present.
+ <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if one if the arguments
+ is the empty string.
+ <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if one of the
+ arguments contains any <a href="#space-character" title="space character">spaces</a>.
- <dt><var title="">tokenlist</var> . <code title="dom-DOMTokenList-remove"><a href="#dom-domtokenlist-remove">remove</a></code>(<var title="">token</var>)
+ <dt><code><var title="">tokenlist</var> . <code title="dom-DOMTokenList-remove"><a href="#dom-domtokenlist-remove">remove</a></code>(<var title="">tokens</var>…)</code>
<dd>
- <p>Removes <var title="">token</var> if it is present.
- <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if <var title="">token</var> is empty.
- <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if <var title="">token</var> contains any spaces.
+ <p>Removes arguments passed, if they are present.
+ <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if one if the arguments
+ is the empty string.
+ <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if one of the
+ arguments contains any <a href="#space-character" title="space character">spaces</a>.
<dt><var title="">hastoken</var> = <var title="">tokenlist</var> . <code title="dom-DOMTokenList-toggle"><a href="#dom-domtokenlist-toggle">toggle</a></code>(<var title="">token</var>)
<dd>
@@ -8503,54 +8507,55 @@ <h3 id="interface-domtokenlist"><span class="secno">9.2 </span>Interface <code><
</ol>
<p>The
-<dfn id="dom-domtokenlist-add" title="dom-DOMTokenList-add"><code>add(<var title="">token</var>)</code></dfn>
+<dfn id="dom-domtokenlist-add" title="dom-DOMTokenList-add"><code>add(<var title="">tokens</var>)</code></dfn>
method must run these steps:
<ol>
- <li>If <var title="">token</var> is the empty string, then
- <a href="#concept-throw" title="concept-throw">throw</a> a
- "<code><a href="#syntaxerror">SyntaxError</a></code>" exception and terminate these steps.
+ <li>If one of the tokens in <var title="">tokens</var> is the empty string,
+ <a href="#concept-throw" title="concept-throw">throw</a> a "<code><a href="#syntaxerror">SyntaxError</a></code>"
+ exception and terminate these steps.
- <li>If <var title="">token</var> contains any
+ <li>If one of the tokens in <var title="">tokens</var> contains any
<a href="#space-character" title="space character">space characters</a>, then
<a href="#concept-throw" title="concept-throw">throw</a> an
- "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these
- steps.
+ "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these steps.
<li><a href="#split-a-string-on-spaces" title="split a string on spaces">Split</a> the
<a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a> on
spaces to get the list of tokens.
- <li>If <var title="">token</var> is a <a href="#case-sensitive">case-sensitive</a> match for one of
- the tokens in the list found in the previous step, then terminate these steps.
+ <li>Remove each token in <var title="">tokens</var> that is a
+ <a href="#case-sensitive">case-sensitive</a> match for one of the tokens in the list found
+ in the previous step. If <var title="">tokens</var> is now empty, then
+ terminate these steps.
<li>If the
- <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a> is not
- the empty string and the last character of that string is not a
+ <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a> is
+ not the empty string and the last character of that string is not a
<a href="#space-character">space character</a>, then append a U+0020 SPACE character to that
string.
- <li>Append <var title="">token</var> to the
- <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a>.
+ <li>Append all tokens in <var title="">tokens</var> to the
+ <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a>
+ separated from each other by a U+0020 SPACE character, in list order.
</ol>
<p>The
-<dfn id="dom-domtokenlist-remove" title="dom-DOMTokenList-remove"><code>remove(<var title="">token</var>)</code></dfn>
+<dfn id="dom-domtokenlist-remove" title="dom-DOMTokenList-remove"><code>remove(<var title="">tokens</var>)</code></dfn>
method must run these steps:
<ol>
- <li>If <var title="">token</var> is the empty string, then
- <a href="#concept-throw" title="concept-throw">throw</a> a
- "<code><a href="#syntaxerror">SyntaxError</a></code>" exception and terminate these steps.
+ <li>If one of the tokens in <var title="">tokens</var> is the empty string,
+ <a href="#concept-throw" title="concept-throw">throw</a> a "<code><a href="#syntaxerror">SyntaxError</a></code>"
+ exception and terminate these steps.
- <li>If <var title="">token</var> contains any
+ <li>If one of the tokens in <var title="">tokens</var> contains any
<a href="#space-character" title="space character">space characters</a>, then
<a href="#concept-throw" title="concept-throw">throw</a> an
- "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these
- steps.
+ "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these steps.
- <li><a href="#remove-a-token-from-a-string" title="remove a token from a string">Remove</a>
- <var title="">token</var> from the
+ <li><a href="#remove-a-token-from-a-string" title="remove a token from a string">Remove</a> each token in
+ <var title="">tokens</var> from the
<a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a>.
</ol>
Please sign in to comment.
Something went wrong with that request. Please try again.