HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2371[Gecko] [Internet Explorer] [Opera] [Webkit] Define four-argument form of new Option(), and clarify that selectedness is not set to true even if the default state is true.2008-10-28 09:52
@@ -30074,21 +30074,22 @@ You cannot complete this form until the field is correct.</samp></pre>
    <dt>Element-specific attributes:</dt>
    <dd><code title="attr-option-disabled">disabled</code></dd>
    <dd><code title="attr-option-label">label</code></dd>
    <dd><code title="attr-option-selected">selected</code></dd>
    <dd><code title="attr-option-value">value</code></dd>
    <dt>DOM interface:</dt>
    <dd>
 <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>;
            attribute DOMString <span title="dom-option-label">label</span>;
            attribute boolean <span title="dom-option-defaultSelected">defaultSelected</span>;
            attribute boolean <span title="dom-option-selected">selected</span>;
            attribute DOMString <span title="dom-option-value">value</span>;
 
   readonly attribute DOMString <span title="dom-option-text">text</span>;
   readonly attribute long <span title="dom-option-index">index</span>;
@@ -30132,29 +30133,37 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
   <p>The <dfn title="attr-option-selected"><code>selected</code></dfn>
   attribute represents the default <span
   title="concept-option-selectedness">selectedness</span> of the
   element.</p>
 
   <p>The <dfn title="concept-option-selectedness">selectedness</dfn>
   of an <code>option</code> element is a boolean state, initially
   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
   title="concept-select-option-list">list of options</span> but that
   come before it in <span>tree order</span>. If the
   <code>option</code> element is not in a <span
   title="concept-select-option-list">list of options</span>, then the
   <code>option</code> element's <span
   title="concept-option-index">index</span> is zero.</p>
 
@@ -30184,43 +30193,52 @@ interface <dfn>HTMLOptionElement</dfn> : <span>HTMLElement</span> {
   attribute's behavior depends on whether the <code>option</code>
   element is in a <code>select</code> element or not. If the
   <code>option</code> has a <code>select</code> element as its parent,
   or has a <code>colgroup</code> element as its parent and that
   <code>colgroup</code> element has a <code>select</code> element as
   its parent, then the <code title="dom-option-form">form</code> DOM
   attribute must return the same value as the <code
   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>
 
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
    <dd><span title="category-listed">Listed</span>, <span title="category-label">labelable</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <span>form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>

|