Browse files

[giow] (2) Define four-argument form of new Option(), and clarify tha…

…t selectedness is not set to true even if the default state is true.

git-svn-id: http://svn.whatwg.org/webapps@2371 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent 330e017 commit 933b4b72dfd84348bbf13055ad14b59a5b92bbb9 @Hixie Hixie committed Oct 28, 2008
Showing with 61 additions and 32 deletions.
  1. +26 −15 index
  2. +35 −17 source
View
41 index
@@ -26840,7 +26840,8 @@ You cannot complete this form until the field is correct.</samp></pre>
<pre class=idl>[<a href=#dom-option title=dom-option>Constructor</a>(),
<a href=#dom-option-t title=dom-option-t>Constructor</a>(in DOMString text),
<a href=#dom-option-tv title=dom-option-tv>Constructor</a>(in DOMString text, in DOMString value),
- <a href=#dom-option-tvd title=dom-option-tvd>Constructor</a>(in DOMString text, in DOMString value, in boolean defaultSelected)]
+ <a href=#dom-option-tvd title=dom-option-tvd>Constructor</a>(in DOMString text, in DOMString value, in boolean defaultSelected),
+ <a href=#dom-option-tvds title=dom-option-tvds>Constructor</a>(in DOMString text, in DOMString value, in boolean defaultSelected, in boolean selected)]
interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute boolean <a href=#dom-option-disabled title=dom-option-disabled>disabled</a>;
readonly attribute <a href=#htmlformelement>HTMLFormElement</a> <a href=#dom-option-form title=dom-option-form>form</a>;
@@ -26885,13 +26886,20 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
of an <code><a href=#the-option-element>option</a></code> element is a boolean state, initially
false. If the element is <a href=#concept-option-disabled title=concept-option-disabled>disabled</a>, then the element's
<a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is
- always false and cannot be set to true. When the element is created,
- its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
- must be set to true if the element has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute. Whenever an
+ always false and cannot be set to true. Unless othewise specified,
+ when the element is created, its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set
+ to true if the element has a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute. Whenever an
<code><a href=#the-option-element>option</a></code> element's <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute is added, its
<a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must
be set to true.</p>
+ <p class=note>The <code title=dom-option-tvd><a href=#dom-option-tvd>Option()</a></code>
+ constructor with two or more arguments overrides the initial state
+ of the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a>
+ state to always be false even if the third argument is true
+ (implying that a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code>
+ attribute is to be set).</p>
+
<p>An <code><a href=#the-option-element>option</a></code> element's <dfn id=concept-option-index title=concept-option-index>index</dfn> is the number of
<code><a href=#the-option-element>option</a></code> element that are in the same <a href=#concept-select-option-list title=concept-select-option-list>list of options</a> but that
come before it in <a href=#tree-order>tree order</a>. If the
@@ -26925,18 +26933,21 @@ interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmleleme
attribute must return the same value as the <code title=dom-select-form>form</code> DOM attribute on that
<code><a href=#the-select-element>select</a></code> element. Otherwise, it must return null.</p>
- <p>Four constructors are provided for creating
+ <p>Several constructors are provided for creating
<code><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in addition to the factory
- methods from DOM Core such as <code title="">createElement()</code>): <dfn id=dom-option title=dom-option><code>Option()</code></dfn>, <dfn id=dom-option-t title=dom-option-t><code>Option(<var title="">text</var>)</code></dfn>, <dfn id=dom-option-tv title=dom-option-tv><code>Option(<var title="">text</var>, <var title="">value</var>)</code></dfn>, and <dfn id=dom-option-tvd title=dom-option-tvd><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>)</code></dfn>. When invoked as
- constructors, these must return a new <code><a href=#htmloptionelement>HTMLOptionElement</a></code>
- object (a new <code><a href=#the-option-element>option</a></code> element). If the <var title="">text</var> argument is present, the new object must have a
- text node with the value of that argument as its data as its only
- child. If the <var title="">value</var> argument is present, the new
- object must have a <code title=attr-option-value><a href=#attr-option-value>value</a></code>
- attribute set with the value of the argument as its value. If the
- <var title="">defaultSelected</var> argument is present and true,
- the new object must have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no
- value.</p>
+ methods from DOM Core such as <code title="">createElement()</code>): <dfn id=dom-option title=dom-option><code>Option()</code></dfn>, <dfn id=dom-option-t title=dom-option-t><code>Option(<var title="">text</var>)</code></dfn>, <dfn id=dom-option-tv title=dom-option-tv><code>Option(<var title="">text</var>, <var title="">value</var>)</code></dfn>, <dfn id=dom-option-tvd title=dom-option-tvd><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>)</code></dfn>, and <dfn id=dom-option-tvds title=dom-option-tvds><code>Option(<var title="">text</var>, <var title="">value</var>, <var title="">defaultSelected</var>, <var title="">selected</var>)</code></dfn>. When invoked as constructors,
+ these must return a new <code><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new
+ <code><a href=#the-option-element>option</a></code> element). If the <var title="">text</var>
+ argument is present, the new object must have a text node with the
+ value of that argument as its data as its only child. If the <var title="">value</var> argument is present, the new object must have a
+ <code title=attr-option-value><a href=#attr-option-value>value</a></code> attribute set with the
+ value of the argument as its value. If the <var title="">defaultSelected</var> argument is present and true, the new
+ object must have a <code title=attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute set with no
+ value. If the <var title="">selected</var> argument is present and
+ true, the new object must have its <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> set to true;
+ otherwise the fouth argument is absent or false, and the <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> must be set
+ to false, even if the <var title="">defaultSelected</var> argument
+ is present and true.</p>
<h4 id=the-textarea-element><span class=secno>4.10.10 </span>The <dfn><code>textarea</code></dfn> element</h4>
View
52 source
@@ -30081,7 +30081,8 @@ You cannot complete this form until the field is correct.</samp></pre>
<pre class="idl">[<span title="dom-option">Constructor</span>(),
<span title="dom-option-t">Constructor</span>(in DOMString text),
<span title="dom-option-tv">Constructor</span>(in DOMString text, in DOMString value),
- <span title="dom-option-tvd">Constructor</span>(in DOMString text, in DOMString value, in boolean defaultSelected)]
+ <span title="dom-option-tvd">Constructor</span>(in DOMString text, in DOMString value, in boolean defaultSelected),
+ <span title="dom-option-tvds">Constructor</span>(in DOMString text, in DOMString value, in boolean defaultSelected, in boolean selected)]
interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
attribute boolean <span title="dom-option-disabled">disabled</span>;
readonly attribute <span>HTMLFormElement</span> <span title="dom-option-form">form</span>;
@@ -30139,15 +30140,23 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
false. If the element is <span
title="concept-option-disabled">disabled</span>, then the element's
<span title="concept-option-selectedness">selectedness</span> is
- always false and cannot be set to true. When the element is created,
- its <span title="concept-option-selectedness">selectedness</span>
- must be set to true if the element has a <code
+ always false and cannot be set to true. Unless othewise specified,
+ when the element is created, its <span
+ title="concept-option-selectedness">selectedness</span> must be set
+ to true if the element has a <code
title="attr-option-selected">selected</code> attribute. Whenever an
<code>option</code> element's <code
title="attr-option-selected">selected</code> attribute is added, its
<span title="concept-option-selectedness">selectedness</span> must
be set to true.</p>
+ <p class="note">The <code title="dom-option-tvd">Option()</code>
+ constructor with two or more arguments overrides the initial state
+ of the <span title="concept-option-selectedness">selectedness</span>
+ state to always be false even if the third argument is true
+ (implying that a <code title="attr-option-selected">selected</code>
+ attribute is to be set).</p>
+
<p>An <code>option</code> element's <dfn
title="concept-option-index">index</dfn> is the number of
<code>option</code> element that are in the same <span
@@ -30191,29 +30200,38 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
title="dom-select-form">form</code> DOM attribute on that
<code>select</code> element. Otherwise, it must return null.</p>
- <p>Four constructors are provided for creating
+ <p>Several constructors are provided for creating
<code>HTMLOptionElement</code> objects (in addition to the factory
methods from DOM Core such as <code
title="">createElement()</code>): <dfn
title="dom-option"><code>Option()</code></dfn>, <dfn
title="dom-option-t"><code>Option(<var
title="">text</var>)</code></dfn>, <dfn
title="dom-option-tv"><code>Option(<var title="">text</var>, <var
- title="">value</var>)</code></dfn>, and <dfn
+ title="">value</var>)</code></dfn>, <dfn
title="dom-option-tvd"><code>Option(<var title="">text</var>, <var
title="">value</var>, <var
- title="">defaultSelected</var>)</code></dfn>. When invoked as
- constructors, these must return a new <code>HTMLOptionElement</code>
- object (a new <code>option</code> element). If the <var
- title="">text</var> argument is present, the new object must have a
- text node with the value of that argument as its data as its only
- child. If the <var title="">value</var> argument is present, the new
- object must have a <code title="attr-option-value">value</code>
- attribute set with the value of the argument as its value. If the
- <var title="">defaultSelected</var> argument is present and true,
- the new object must have a <code
+ title="">defaultSelected</var>)</code></dfn>, and <dfn
+ title="dom-option-tvds"><code>Option(<var title="">text</var>, <var
+ title="">value</var>, <var title="">defaultSelected</var>, <var
+ title="">selected</var>)</code></dfn>. When invoked as constructors,
+ these must return a new <code>HTMLOptionElement</code> object (a new
+ <code>option</code> element). If the <var title="">text</var>
+ argument is present, the new object must have a text node with the
+ value of that argument as its data as its only child. If the <var
+ title="">value</var> argument is present, the new object must have a
+ <code title="attr-option-value">value</code> attribute set with the
+ value of the argument as its value. If the <var
+ title="">defaultSelected</var> argument is present and true, the new
+ object must have a <code
title="attr-option-selected">selected</code> attribute set with no
- value.</p>
+ value. If the <var title="">selected</var> argument is present and
+ true, the new object must have its <span
+ title="concept-option-selectedness">selectedness</span> set to true;
+ otherwise the fouth argument is absent or false, and the <span
+ title="concept-option-selectedness">selectedness</span> must be set
+ to false, even if the <var title="">defaultSelected</var> argument
+ is present and true.</p>
<h4>The <dfn><code>textarea</code></dfn> element</h4>

0 comments on commit 933b4b7

Please sign in to comment.