Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

make DOMTokenList add/remove support variable arity

  • Loading branch information...
commit 91fcd602fc31310aee487ebf809451195f64af9e 1 parent 68206e3
Anne van Kesteren annevk authored

Showing 2 changed files with 80 additions and 70 deletions. Show diff stats Hide diff stats

  1. +40 35 Overview.src.html
  2. +40 35 dom-core.html
75 Overview.src.html
@@ -8386,11 +8386,11 @@ <h2 class=no-num>Goals</h2>
8386 8386
8387 8387 <pre class="idl">interface <dfn>DOMTokenList</dfn> {
8388 8388 readonly attribute unsigned long <span title="dom-DOMTokenList-length">length</span>;
8389   - getter DOMString? <span title="dom-DOMTokenList-item">item</span>(unsigned long index);
8390   - boolean <span title="dom-DOMTokenList-contains">contains</span>(DOMString token);
8391   - void <span title="dom-DOMTokenList-add">add</span>(DOMString token);
8392   - void <span title="dom-DOMTokenList-remove">remove</span>(DOMString token);
8393   - boolean <span title="dom-DOMTokenList-toggle">toggle</span>(DOMString token);
  8389 + getter DOMString? <span title="dom-DOMTokenList-item">item</span>(unsigned long <var title>index</var>);
  8390 + boolean <span title="dom-DOMTokenList-contains">contains</span>(DOMString <var title>token</var>);
  8391 + void <span title="dom-DOMTokenList-add">add</span>(DOMString... <var title>tokens</var>);
  8392 + void <span title="dom-DOMTokenList-remove">remove</span>(DOMString... <var title>tokens</var>);
  8393 + boolean <span title="dom-DOMTokenList-toggle">toggle</span>(DOMString <var title>token</var>);
8394 8394 <span title="dom-DOMTokenList-toString">stringifier</span> DOMString ();
8395 8395 };</pre>
8396 8396
@@ -8410,17 +8410,21 @@ <h2 class=no-num>Goals</h2>
8410 8410 <p>Throws a "<code>SyntaxError</code>" exception if <var title>token</var> is empty.
8411 8411 <p>Throws an "<code>InvalidCharacterError</code>" exception if <var title>token</var> contains any spaces.
8412 8412
8413   - <dt><var title>tokenlist</var> . <code title="dom-DOMTokenList-add">add</code>(<var title>token</var>)
  8413 + <dt><code><var title>tokenlist</var> . <span title=dom-DOMTokenList-add>add</span>(<var title>tokens</var>&hellip;)</code>
8414 8414 <dd>
8415   - <p>Adds <var title>token</var>, unless it is already present.
8416   - <p>Throws a "<code>SyntaxError</code>" exception if <var title>token</var> is empty.
8417   - <p>Throws an "<code>InvalidCharacterError</code>" exception if <var title>token</var> contains any spaces.
  8415 + <p>Adds all arguments passed, except those already present.
  8416 + <p>Throws a "<code>SyntaxError</code>" exception if one if the arguments
  8417 + is the empty string.
  8418 + <p>Throws an "<code>InvalidCharacterError</code>" exception if one of the
  8419 + arguments contains any <span title="space character">spaces</span>.
8418 8420
8419   - <dt><var title>tokenlist</var> . <code title="dom-DOMTokenList-remove">remove</code>(<var title>token</var>)
  8421 + <dt><code><var title>tokenlist</var> . <code title=dom-DOMTokenList-remove>remove</code>(<var title>tokens</var>&hellip;)</code>
8420 8422 <dd>
8421   - <p>Removes <var title>token</var> if it is present.
8422   - <p>Throws a "<code>SyntaxError</code>" exception if <var title>token</var> is empty.
8423   - <p>Throws an "<code>InvalidCharacterError</code>" exception if <var title>token</var> contains any spaces.
  8423 + <p>Removes arguments passed, if they are present.
  8424 + <p>Throws a "<code>SyntaxError</code>" exception if one if the arguments
  8425 + is the empty string.
  8426 + <p>Throws an "<code>InvalidCharacterError</code>" exception if one of the
  8427 + arguments contains any <span title="space character">spaces</span>.
8424 8428
8425 8429 <dt><var title>hastoken</var> = <var title>tokenlist</var> . <code title="dom-DOMTokenList-toggle">toggle</code>(<var title>token</var>)
8426 8430 <dd>
@@ -8497,54 +8501,55 @@ <h2 class=no-num>Goals</h2>
8497 8501 </ol>
8498 8502
8499 8503 <p>The
8500   -<dfn title="dom-DOMTokenList-add"><code>add(<var title>token</var>)</code></dfn>
  8504 +<dfn title=dom-DOMTokenList-add><code>add(<var title>tokens</var>&hellip;)</code></dfn>
8501 8505 method must run these steps:
8502 8506
8503 8507 <ol>
8504   - <li>If <var title>token</var> is the empty string, then
8505   - <span title=concept-throw>throw</span> a
8506   - "<code>SyntaxError</code>" exception and terminate these steps.
  8508 + <li>If one of the tokens in <var title>tokens</var> is the empty string,
  8509 + <span title=concept-throw>throw</span> a "<code>SyntaxError</code>"
  8510 + exception and terminate these steps.
8507 8511
8508   - <li>If <var title>token</var> contains any
  8512 + <li>If one of the tokens in <var title>tokens</var> contains any
8509 8513 <span title="space character">space characters</span>, then
8510 8514 <span title=concept-throw>throw</span> an
8511   - "<code>InvalidCharacterError</code>" exception and terminate these
8512   - steps.
  8515 + "<code>InvalidCharacterError</code>" exception and terminate these steps.
8513 8516
8514 8517 <li><span title="split a string on spaces">Split</span> the
8515 8518 <span title=concept-tokenlist-underlying-string>underlying string</span> on
8516 8519 spaces to get the list of tokens.
8517 8520
8518   - <li>If <var title>token</var> is a <span>case-sensitive</span> match for one of
8519   - the tokens in the list found in the previous step, then terminate these steps.
  8521 + <li>Remove each token in <var title>tokens</var> that is a
  8522 + <span>case-sensitive</span> match for one of the tokens in the list found
  8523 + in the previous step. If <var title>tokens</var> is now empty, then
  8524 + terminate these steps.
8520 8525
8521 8526 <li>If the
8522   - <span title=concept-tokenlist-underlying-string>underlying string</span> is not
8523   - the empty string and the last character of that string is not a
  8527 + <span title=concept-tokenlist-underlying-string>underlying string</span> is
  8528 + not the empty string and the last character of that string is not a
8524 8529 <span>space character</span>, then append a U+0020 SPACE character to that
8525 8530 string.
8526 8531
8527   - <li>Append <var title>token</var> to the
8528   - <span title=concept-tokenlist-underlying-string>underlying string</span>.
  8532 + <li>Append all tokens in <var title>tokens</var> to the
  8533 + <span title=concept-tokenlist-underlying-string>underlying string</span>
  8534 + separated from each other by a U+0020 SPACE character, in list order.
8529 8535 </ol>
8530 8536
8531 8537 <p>The
8532   -<dfn title="dom-DOMTokenList-remove"><code>remove(<var title>token</var>)</code></dfn>
  8538 +<dfn title="dom-DOMTokenList-remove"><code>remove(<var title>tokens</var>&hellip;)</code></dfn>
8533 8539 method must run these steps:
8534 8540
8535 8541 <ol>
8536   - <li>If <var title>token</var> is the empty string, then
8537   - <span title=concept-throw>throw</span> a
8538   - "<code>SyntaxError</code>" exception and terminate these steps.
  8542 + <li>If one of the tokens in <var title>tokens</var> is the empty string,
  8543 + <span title=concept-throw>throw</span> a "<code>SyntaxError</code>"
  8544 + exception and terminate these steps.
8539 8545
8540   - <li>If <var title>token</var> contains any
  8546 + <li>If one of the tokens in <var title>tokens</var> contains any
8541 8547 <span title="space character">space characters</span>, then
8542 8548 <span title=concept-throw>throw</span> an
8543   - "<code>InvalidCharacterError</code>" exception and terminate these
8544   - steps.
  8549 + "<code>InvalidCharacterError</code>" exception and terminate these steps.
8545 8550
8546   - <li><span title="remove a token from a string">Remove</span>
8547   - <var title>token</var> from the
  8551 + <li><span title="remove a token from a string">Remove</span> each token in
  8552 + <var title>tokens</var> from the
8548 8553 <span title=concept-tokenlist-underlying-string>underlying string</span>.
8549 8554 </ol>
8550 8555
75 dom-core.html
@@ -8392,11 +8392,11 @@ <h3 id="interface-domtokenlist"><span class="secno">9.2 </span>Interface <code><
8392 8392
8393 8393 <pre class="idl">interface <dfn id="domtokenlist">DOMTokenList</dfn> {
8394 8394 readonly attribute unsigned long <a href="#dom-domtokenlist-length" title="dom-DOMTokenList-length">length</a>;
8395   - getter DOMString? <a href="#dom-domtokenlist-item" title="dom-DOMTokenList-item">item</a>(unsigned long index);
8396   - boolean <a href="#dom-domtokenlist-contains" title="dom-DOMTokenList-contains">contains</a>(DOMString token);
8397   - void <a href="#dom-domtokenlist-add" title="dom-DOMTokenList-add">add</a>(DOMString token);
8398   - void <a href="#dom-domtokenlist-remove" title="dom-DOMTokenList-remove">remove</a>(DOMString token);
8399   - boolean <a href="#dom-domtokenlist-toggle" title="dom-DOMTokenList-toggle">toggle</a>(DOMString token);
  8395 + getter DOMString? <a href="#dom-domtokenlist-item" title="dom-DOMTokenList-item">item</a>(unsigned long <var title="">index</var>);
  8396 + boolean <a href="#dom-domtokenlist-contains" title="dom-DOMTokenList-contains">contains</a>(DOMString <var title="">token</var>);
  8397 + void <a href="#dom-domtokenlist-add" title="dom-DOMTokenList-add">add</a>(DOMString... <var title="">tokens</var>);
  8398 + void <a href="#dom-domtokenlist-remove" title="dom-DOMTokenList-remove">remove</a>(DOMString... <var title="">tokens</var>);
  8399 + boolean <a href="#dom-domtokenlist-toggle" title="dom-DOMTokenList-toggle">toggle</a>(DOMString <var title="">token</var>);
8400 8400 <a href="#dom-domtokenlist-tostring" title="dom-DOMTokenList-toString">stringifier</a> DOMString ();
8401 8401 };</pre>
8402 8402
@@ -8416,17 +8416,21 @@ <h3 id="interface-domtokenlist"><span class="secno">9.2 </span>Interface <code><
8416 8416 <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if <var title="">token</var> is empty.
8417 8417 <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if <var title="">token</var> contains any spaces.
8418 8418
8419   - <dt><var title="">tokenlist</var> . <code title="dom-DOMTokenList-add"><a href="#dom-domtokenlist-add">add</a></code>(<var title="">token</var>)
  8419 + <dt><code><var title="">tokenlist</var> . <a href="#dom-domtokenlist-add" title="dom-DOMTokenList-add">add</a>(<var title="">tokens</var>…)</code>
8420 8420 <dd>
8421   - <p>Adds <var title="">token</var>, unless it is already present.
8422   - <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if <var title="">token</var> is empty.
8423   - <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if <var title="">token</var> contains any spaces.
  8421 + <p>Adds all arguments passed, except those already present.
  8422 + <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if one if the arguments
  8423 + is the empty string.
  8424 + <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if one of the
  8425 + arguments contains any <a href="#space-character" title="space character">spaces</a>.
8424 8426
8425   - <dt><var title="">tokenlist</var> . <code title="dom-DOMTokenList-remove"><a href="#dom-domtokenlist-remove">remove</a></code>(<var title="">token</var>)
  8427 + <dt><code><var title="">tokenlist</var> . <code title="dom-DOMTokenList-remove"><a href="#dom-domtokenlist-remove">remove</a></code>(<var title="">tokens</var>…)</code>
8426 8428 <dd>
8427   - <p>Removes <var title="">token</var> if it is present.
8428   - <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if <var title="">token</var> is empty.
8429   - <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if <var title="">token</var> contains any spaces.
  8429 + <p>Removes arguments passed, if they are present.
  8430 + <p>Throws a "<code><a href="#syntaxerror">SyntaxError</a></code>" exception if one if the arguments
  8431 + is the empty string.
  8432 + <p>Throws an "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception if one of the
  8433 + arguments contains any <a href="#space-character" title="space character">spaces</a>.
8430 8434
8431 8435 <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>)
8432 8436 <dd>
@@ -8503,54 +8507,55 @@ <h3 id="interface-domtokenlist"><span class="secno">9.2 </span>Interface <code><
8503 8507 </ol>
8504 8508
8505 8509 <p>The
8506   -<dfn id="dom-domtokenlist-add" title="dom-DOMTokenList-add"><code>add(<var title="">token</var>)</code></dfn>
  8510 +<dfn id="dom-domtokenlist-add" title="dom-DOMTokenList-add"><code>add(<var title="">tokens</var>…)</code></dfn>
8507 8511 method must run these steps:
8508 8512
8509 8513 <ol>
8510   - <li>If <var title="">token</var> is the empty string, then
8511   - <a href="#concept-throw" title="concept-throw">throw</a> a
8512   - "<code><a href="#syntaxerror">SyntaxError</a></code>" exception and terminate these steps.
  8514 + <li>If one of the tokens in <var title="">tokens</var> is the empty string,
  8515 + <a href="#concept-throw" title="concept-throw">throw</a> a "<code><a href="#syntaxerror">SyntaxError</a></code>"
  8516 + exception and terminate these steps.
8513 8517
8514   - <li>If <var title="">token</var> contains any
  8518 + <li>If one of the tokens in <var title="">tokens</var> contains any
8515 8519 <a href="#space-character" title="space character">space characters</a>, then
8516 8520 <a href="#concept-throw" title="concept-throw">throw</a> an
8517   - "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these
8518   - steps.
  8521 + "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these steps.
8519 8522
8520 8523 <li><a href="#split-a-string-on-spaces" title="split a string on spaces">Split</a> the
8521 8524 <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a> on
8522 8525 spaces to get the list of tokens.
8523 8526
8524   - <li>If <var title="">token</var> is a <a href="#case-sensitive">case-sensitive</a> match for one of
8525   - the tokens in the list found in the previous step, then terminate these steps.
  8527 + <li>Remove each token in <var title="">tokens</var> that is a
  8528 + <a href="#case-sensitive">case-sensitive</a> match for one of the tokens in the list found
  8529 + in the previous step. If <var title="">tokens</var> is now empty, then
  8530 + terminate these steps.
8526 8531
8527 8532 <li>If the
8528   - <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a> is not
8529   - the empty string and the last character of that string is not a
  8533 + <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a> is
  8534 + not the empty string and the last character of that string is not a
8530 8535 <a href="#space-character">space character</a>, then append a U+0020 SPACE character to that
8531 8536 string.
8532 8537
8533   - <li>Append <var title="">token</var> to the
8534   - <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a>.
  8538 + <li>Append all tokens in <var title="">tokens</var> to the
  8539 + <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a>
  8540 + separated from each other by a U+0020 SPACE character, in list order.
8535 8541 </ol>
8536 8542
8537 8543 <p>The
8538   -<dfn id="dom-domtokenlist-remove" title="dom-DOMTokenList-remove"><code>remove(<var title="">token</var>)</code></dfn>
  8544 +<dfn id="dom-domtokenlist-remove" title="dom-DOMTokenList-remove"><code>remove(<var title="">tokens</var>…)</code></dfn>
8539 8545 method must run these steps:
8540 8546
8541 8547 <ol>
8542   - <li>If <var title="">token</var> is the empty string, then
8543   - <a href="#concept-throw" title="concept-throw">throw</a> a
8544   - "<code><a href="#syntaxerror">SyntaxError</a></code>" exception and terminate these steps.
  8548 + <li>If one of the tokens in <var title="">tokens</var> is the empty string,
  8549 + <a href="#concept-throw" title="concept-throw">throw</a> a "<code><a href="#syntaxerror">SyntaxError</a></code>"
  8550 + exception and terminate these steps.
8545 8551
8546   - <li>If <var title="">token</var> contains any
  8552 + <li>If one of the tokens in <var title="">tokens</var> contains any
8547 8553 <a href="#space-character" title="space character">space characters</a>, then
8548 8554 <a href="#concept-throw" title="concept-throw">throw</a> an
8549   - "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these
8550   - steps.
  8555 + "<code><a href="#invalidcharactererror">InvalidCharacterError</a></code>" exception and terminate these steps.
8551 8556
8552   - <li><a href="#remove-a-token-from-a-string" title="remove a token from a string">Remove</a>
8553   - <var title="">token</var> from the
  8557 + <li><a href="#remove-a-token-from-a-string" title="remove a token from a string">Remove</a> each token in
  8558 + <var title="">tokens</var> from the
8554 8559 <a href="#concept-tokenlist-underlying-string" title="concept-tokenlist-underlying-string">underlying string</a>.
8555 8560 </ol>
8556 8561

0 comments on commit 91fcd60

Please sign in to comment.
Something went wrong with that request. Please try again.