Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[] (0) Make DOMTokenList not remove duplicates.
git-svn-id: http://svn.whatwg.org/webapps@3479 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 28, 2009
1 parent 7ec04ab commit b3bd632
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 34 deletions.
26 changes: 10 additions & 16 deletions index
Expand Up @@ -5968,13 +5968,8 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
<h4 id=domtokenlist><span class=secno>2.8.3 </span>DOMTokenList</h4>

<p>The <code><a href=#domtokenlist-0>DOMTokenList</a></code> interface represents an interface
to an underlying string that consists of an <a href=#unordered-set-of-unique-space-separated-tokens>unordered set of
unique space-separated tokens</a>.</p>

<p class=note>While the order of the tokens in the underlying
string is not important, the <code><a href=#domtokenlist-0>DOMTokenList</a></code> interfaces
preserves the underlying order for consistency between
implementations.</p>
to an underlying string that consists of a <a href=#set-of-space-separated-tokens>set of
space-separated tokens</a>.</p>

<p class=note><code><a href=#domtokenlist-0>DOMTokenList</a></code> objects are always
<a href=#case-sensitive>case-sensitive</a>, even when the underlying string might
Expand All @@ -5997,7 +5992,7 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
<dt><var title="">element</var> = <var title="">tokenlist</var> . <code title=dom-tokenlist-item><a href=#dom-tokenlist-item>item</a></code>(<var title="">index</var>)</dt>
<dt><var title="">tokenlist</var>[<var title="">index</var>]</dt>
<dd>
<p>Returns the token with index <var title="">index</var>. The tokens are returned in the order they are found in the underlying string, with duplicates removed.</p>
<p>Returns the token with index <var title="">index</var>. The tokens are returned in the order they are found in the underlying string.</p>
<p>Returns null if <var title="">index</var> is out of range.</p>
</dd>

Expand Down Expand Up @@ -6032,9 +6027,8 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
</dl><div class=impl>

<p>The <dfn id=dom-tokenlist-length title=dom-tokenlist-length><code>length</code></dfn>
attribute must return the number of <em>unique</em> tokens that
result from <a href=#split-a-string-on-spaces title="split a string on spaces">splitting the
underlying string on spaces</a>. This is the <var title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></var>.</p>
attribute must return the number of tokens that result from <a href=#split-a-string-on-spaces title="split a string on spaces">splitting the underlying string on
spaces</a>. This is the <var title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></var>.</p>

<p>The object's <span>indices of the supported indexed
properties</span> are the numbers in the range zero to <span title=""><var title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></var>-1</span>, unless the <var title=dom-tokenlist-length><a href=#dom-tokenlist-length>length</a></var> is zero, in which case
Expand All @@ -6043,13 +6037,13 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
<p>The <dfn id=dom-tokenlist-item title=dom-tokenlist-item><code>item(<var title="">index</var>)</code></dfn> method must <a href=#split-a-string-on-spaces title="split a
string on spaces">split the underlying string on spaces</a>,
preserving the order of the tokens as found in the underlying
string, remove instances of exact duplicates other than the first
instance in each case, and then return the <var title="">index</var>th item in this list. If <var title="">index</var> is equal to or greater than the number of
tokens, then the method must return null.</p>
string, and then return the <var title="">index</var>th item in this
list. If <var title="">index</var> is equal to or greater than the
number of tokens, then the method must return null.</p>

<p class=example>For example, if the string is "<code title="">a b
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>
a c</code>" then there are four tokens: the token with index 0 is
"<code title="">a</code>", the token with index 1 is "<code title="">b</code>", the token with index 2 is "<code title="">a</code>", and the token with index 3 is "<code title="">c</code>".</p>

<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>
Expand Down
30 changes: 12 additions & 18 deletions source
Expand Up @@ -5838,13 +5838,8 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
<h4>DOMTokenList</h4>

<p>The <code>DOMTokenList</code> interface represents an interface
to an underlying string that consists of an <span>unordered set of
unique space-separated tokens</span>.</p>

<p class="note">While the order of the tokens in the underlying
string is not important, the <code>DOMTokenList</code> interfaces
preserves the underlying order for consistency between
implementations.</p>
to an underlying string that consists of a <span>set of
space-separated tokens</span>.</p>

<p class="note"><code>DOMTokenList</code> objects are always
<span>case-sensitive</span>, even when the underlying string might
Expand All @@ -5869,7 +5864,7 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
<dt><var title="">element</var> = <var title="">tokenlist</var> . <code title="dom-tokenlist-item">item</code>(<var title="">index</var>)</dt>
<dt><var title="">tokenlist</var>[<var title="">index</var>]</dt>
<dd>
<p>Returns the token with index <var title="">index</var>. The tokens are returned in the order they are found in the underlying string, with duplicates removed.</p>
<p>Returns the token with index <var title="">index</var>. The tokens are returned in the order they are found in the underlying string.</p>
<p>Returns null if <var title="">index</var> is out of range.</p>
</dd>

Expand Down Expand Up @@ -5906,9 +5901,9 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
<div class="impl">

<p>The <dfn title="dom-tokenlist-length"><code>length</code></dfn>
attribute must return the number of <em>unique</em> tokens that
result from <span title="split a string on spaces">splitting the
underlying string on spaces</span>. This is the <var
attribute must return the number of tokens that result from <span
title="split a string on spaces">splitting the underlying string on
spaces</span>. This is the <var
title="dom-tokenlist-length">length</var>.</p>

<p>The object's <span>indices of the supported indexed
Expand All @@ -5921,16 +5916,15 @@ interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
title="">index</var>)</code></dfn> method must <span title="split a
string on spaces">split the underlying string on spaces</span>,
preserving the order of the tokens as found in the underlying
string, remove instances of exact duplicates other than the first
instance in each case, and then return the <var
title="">index</var>th item in this list. If <var
title="">index</var> is equal to or greater than the number of
tokens, then the method must return null.</p>
string, and then return the <var title="">index</var>th item in this
list. If <var title="">index</var> is equal to or greater than the
number of tokens, then the method must return null.</p>

<p class="example">For example, if the string is "<code title="">a b
a c</code>" then there are three tokens: the token with index 0 is
a c</code>" then there are four 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="">b</code>", the token with index 2 is "<code
title="">a</code>", and the token with index 3 is "<code
title="">c</code>".</p>

<p>The <dfn title="dom-tokenlist-contains"><code>contains(<var
Expand Down

0 comments on commit b3bd632

Please sign in to comment.