Skip to content
Permalink
Browse files

[giow] (2) Document the setter on <select> and <select>.options

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12639

git-svn-id: http://svn.whatwg.org/webapps@6360 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 3, 2011
1 parent 89a61cf commit 828c0912bf6cb5d22e4f7bead4c7dc621b9a24fe
Showing with 103 additions and 3 deletions.
  1. +31 −1 complete.html
  2. +31 −1 index
  3. +41 −1 source
// inherits <span title=dom-HTMLCollection-item>item</span>()
attribute unsigned long <a href=#dom-htmloptionscollection-length title=dom-HTMLOptionsCollection-length>length</a>; // overrides inherited length
caller getter object? <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
<a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (in unsigned long index, in <a href=#htmloptionelement>HTMLOptionElement</a> option);
void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in optional <a href=#htmlelement>HTMLElement</a>? before);
void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in long before);
void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>(in long index);
<code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted, where <var title="">n</var> is the difference between the two numbers (new
value minus old value). Mutation events must be fired as if a
<code><a href=#documentfragment>DocumentFragment</a></code> containing the new <code><a href=#the-option-element>option</a></code>
elements had been inserted. If the new value is lower, then the
elements had been inserted. If the new value is lower, then the
last <var title="">n</var> nodes in the collection must be removed
from their parent nodes, where <var title="">n</var> is the
difference between the two numbers (old value minus new value).</p>

<li>Return that <code><a href=#nodelist>NodeList</a></code> object.</li>

</ol><p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
indexed property</dfn> for a given property index <var title="">index</var> to a new value <var title="">value</var>, it
must run the following algorithm:</p>

<ol><li><p>Let <var title="">length</var> be the number of nodes
<a href=#represented-by-the-collection>represented by the collection</a>.</li>

<li><p>Let <var title="">n</var> be <var title="">index</var> minus
<var title="">length</var>.</li>

<li><p>If <var title="">n</var> is greater than one, then append
<var title="">n</var> new <code><a href=#the-option-element>option</a></code> elements with no
attributes and no child nodes to the <code><a href=#the-select-element>select</a></code> element on
which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted. Mutation
events must be fired as if a <code><a href=#documentfragment>DocumentFragment</a></code>
containing the new <code><a href=#the-option-element>option</a></code> elements had been
inserted.</li>

<li><p>If <var title="">n</var> is zero, append <var title="">value</var> to the <code><a href=#the-select-element>select</a></code> element. Otherwise,
replace the <var title="">index</var>th element in the collection
by <var title="">value</var>.</li>

</ol><p>The <dfn id=dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add><code>add(<var title="">element</var>, <var title="">before</var>)</code></dfn>
method must act according to the following algorithm:</p>

void <a href=#dom-select-add title=dom-select-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in optional <a href=#htmlelement>HTMLElement</a>? before);
void <a href=#dom-select-add title=dom-select-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in long before);
void <a href=#dom-select-remove title=dom-select-remove>remove</a>(in long index);
<a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (in unsigned long index, in <a href=#htmloptionelement>HTMLOptionElement</a> option);

readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-select-selectedoptions title=dom-select-selectedOptions>selectedOptions</a>;
attribute long <a href=#dom-select-selectedindex title=dom-select-selectedIndex>selectedIndex</a>;
returned by the method of the same name on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection, when invoked
with the same argument.</p>

<p>When the user agent is to <dfn id=dom-htmlselectelement-setter title=dom-HTMLSelectElement-setter>set the value of a new indexed
property</dfn> for a given property index <var title="">index</var>
to a new value <var title="">value</var>, it must instead <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
indexed property</a> with the given property index <var title="">index</var> to the new value <var title="">value</var> on the
<code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>

<p>Similarly, the <dfn id=dom-select-add title=dom-select-add><code>add()</code></dfn> and <dfn id=dom-select-remove title=dom-select-remove><code>remove()</code></dfn> methods must
act like their namesake methods on that same <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>

32 index
// inherits <span title=dom-HTMLCollection-item>item</span>()
attribute unsigned long <a href=#dom-htmloptionscollection-length title=dom-HTMLOptionsCollection-length>length</a>; // overrides inherited length
caller getter object? <a href=#dom-htmloptionscollection-nameditem title=dom-HTMLOptionsCollection-namedItem>namedItem</a>(in DOMString name); // overrides inherited namedItem()
<a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (in unsigned long index, in <a href=#htmloptionelement>HTMLOptionElement</a> option);
void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in optional <a href=#htmlelement>HTMLElement</a>? before);
void <a href=#dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in long before);
void <a href=#dom-htmloptionscollection-remove title=dom-HTMLOptionsCollection-remove>remove</a>(in long index);
<code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted, where <var title="">n</var> is the difference between the two numbers (new
value minus old value). Mutation events must be fired as if a
<code><a href=#documentfragment>DocumentFragment</a></code> containing the new <code><a href=#the-option-element>option</a></code>
elements had been inserted. If the new value is lower, then the
elements had been inserted. If the new value is lower, then the
last <var title="">n</var> nodes in the collection must be removed
from their parent nodes, where <var title="">n</var> is the
difference between the two numbers (old value minus new value).</p>

<li>Return that <code><a href=#nodelist>NodeList</a></code> object.</li>

</ol><p>When the user agent is to <dfn id=dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
indexed property</dfn> for a given property index <var title="">index</var> to a new value <var title="">value</var>, it
must run the following algorithm:</p>

<ol><li><p>Let <var title="">length</var> be the number of nodes
<a href=#represented-by-the-collection>represented by the collection</a>.</li>

<li><p>Let <var title="">n</var> be <var title="">index</var> minus
<var title="">length</var>.</li>

<li><p>If <var title="">n</var> is greater than one, then append
<var title="">n</var> new <code><a href=#the-option-element>option</a></code> elements with no
attributes and no child nodes to the <code><a href=#the-select-element>select</a></code> element on
which the <code><a href=#htmloptionscollection>HTMLOptionsCollection</a></code> is rooted. Mutation
events must be fired as if a <code><a href=#documentfragment>DocumentFragment</a></code>
containing the new <code><a href=#the-option-element>option</a></code> elements had been
inserted.</li>

<li><p>If <var title="">n</var> is zero, append <var title="">value</var> to the <code><a href=#the-select-element>select</a></code> element. Otherwise,
replace the <var title="">index</var>th element in the collection
by <var title="">value</var>.</li>

</ol><p>The <dfn id=dom-htmloptionscollection-add title=dom-HTMLOptionsCollection-add><code>add(<var title="">element</var>, <var title="">before</var>)</code></dfn>
method must act according to the following algorithm:</p>

void <a href=#dom-select-add title=dom-select-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in optional <a href=#htmlelement>HTMLElement</a>? before);
void <a href=#dom-select-add title=dom-select-add>add</a>(in <a href=#htmlelement>HTMLElement</a> element, in long before);
void <a href=#dom-select-remove title=dom-select-remove>remove</a>(in long index);
<a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>setter creator</a> void (in unsigned long index, in <a href=#htmloptionelement>HTMLOptionElement</a> option);

readonly attribute <a href=#htmlcollection>HTMLCollection</a> <a href=#dom-select-selectedoptions title=dom-select-selectedOptions>selectedOptions</a>;
attribute long <a href=#dom-select-selectedindex title=dom-select-selectedIndex>selectedIndex</a>;
returned by the method of the same name on the <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection, when invoked
with the same argument.</p>

<p>When the user agent is to <dfn id=dom-htmlselectelement-setter title=dom-HTMLSelectElement-setter>set the value of a new indexed
property</dfn> for a given property index <var title="">index</var>
to a new value <var title="">value</var>, it must instead <a href=#dom-htmloptionscollection-setter title=dom-HTMLOptionsCollection-setter>set the value of a new
indexed property</a> with the given property index <var title="">index</var> to the new value <var title="">value</var> on the
<code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>

<p>Similarly, the <dfn id=dom-select-add title=dom-select-add><code>add()</code></dfn> and <dfn id=dom-select-remove title=dom-select-remove><code>remove()</code></dfn> methods must
act like their namesake methods on that same <code title=dom-select-options><a href=#dom-select-options>options</a></code> collection.</p>

42 source
@@ -8106,6 +8106,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
// inherits <span title="dom-HTMLCollection-item">item</span>()
attribute unsigned long <span title="dom-HTMLOptionsCollection-length">length</span>; // overrides inherited length
caller getter object? <span title="dom-HTMLOptionsCollection-namedItem">namedItem</span>(in DOMString name); // overrides inherited namedItem()
<span title="dom-HTMLOptionsCollection-setter">setter creator</span> void (in unsigned long index, in <span>HTMLOptionElement</span> option);
void <span title="dom-HTMLOptionsCollection-add">add</span>(in <span>HTMLElement</span> element, in optional <span>HTMLElement</span>? before);
void <span title="dom-HTMLOptionsCollection-add">add</span>(in <span>HTMLElement</span> element, in long before);
void <span title="dom-HTMLOptionsCollection-remove">remove</span>(in long index);
@@ -8188,7 +8189,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
title="">n</var> is the difference between the two numbers (new
value minus old value). Mutation events must be fired as if a
<code>DocumentFragment</code> containing the new <code>option</code>
elements had been inserted. If the new value is lower, then the
elements had been inserted. If the new value is lower, then the
last <var title="">n</var> nodes in the collection must be removed
from their parent nodes, where <var title="">n</var> is the
difference between the two numbers (old value minus new value).</p>
@@ -8237,6 +8238,35 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..

</ol>

<p>When the user agent is to <dfn
title="dom-HTMLOptionsCollection-setter">set the value of a new
indexed property</dfn> for a given property index <var
title="">index</var> to a new value <var title="">value</var>, it
must run the following algorithm:</p>

<ol>

<li><p>Let <var title="">length</var> be the number of nodes
<span>represented by the collection</span>.</p></li>

<li><p>Let <var title="">n</var> be <var title="">index</var> minus
<var title="">length</var>.</p></li>

<li><p>If <var title="">n</var> is greater than one, then append
<var title="">n</var> new <code>option</code> elements with no
attributes and no child nodes to the <code>select</code> element on
which the <code>HTMLOptionsCollection</code> is rooted. Mutation
events must be fired as if a <code>DocumentFragment</code>
containing the new <code>option</code> elements had been
inserted.</p></li>

<li><p>If <var title="">n</var> is zero, append <var
title="">value</var> to the <code>select</code> element. Otherwise,
replace the <var title="">index</var>th element in the collection
by <var title="">value</var>.</p></li>

</ol>

<p>The <dfn title="dom-HTMLOptionsCollection-add"><code>add(<var
title="">element</var>, <var title="">before</var>)</code></dfn>
method must act according to the following algorithm:</p>
void <span title="dom-select-add">add</span>(in <span>HTMLElement</span> element, in optional <span>HTMLElement</span>? before);
void <span title="dom-select-add">add</span>(in <span>HTMLElement</span> element, in long before);
void <span title="dom-select-remove">remove</span>(in long index);
<span title="dom-HTMLOptionsCollection-setter">setter creator</span> void (in unsigned long index, in <span>HTMLOptionElement</span> option);

readonly attribute <span>HTMLCollection</span> <span title="dom-select-selectedOptions">selectedOptions</span>;
attribute long <span title="dom-select-selectedIndex">selectedIndex</span>;
title="dom-select-options">options</code> collection, when invoked
with the same argument.</p>

<p>When the user agent is to <dfn
title="dom-HTMLSelectElement-setter">set the value of a new indexed
property</dfn> for a given property index <var title="">index</var>
to a new value <var title="">value</var>, it must instead <span
title="dom-HTMLOptionsCollection-setter">set the value of a new
indexed property</span> with the given property index <var
title="">index</var> to the new value <var title="">value</var> on the
<code title="dom-select-options">options</code> collection.</p>

<p>Similarly, the <dfn
title="dom-select-add"><code>add()</code></dfn> and <dfn
title="dom-select-remove"><code>remove()</code></dfn> methods must

0 comments on commit 828c091

Please sign in to comment.
You can’t perform that action at this time.