HTML Standard Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/2371

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
Index: source
===================================================================
--- source	(revision 2370)
+++ source	(revision 2371)
@@ -30081,7 +30081,8 @@
 <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 @@
   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,7 +30200,7 @@
   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
@@ -30199,21 +30208,30 @@
   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>

|