HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2889Support select.add(e) and select.options.add(e) with no second argument. (credit: cm)2009-03-20 23:04
@@ -6006,21 +6006,21 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
   <p>The <code>HTMLOptionsCollection</code> interface represents a
   list of <code>option</code> elements. It is always rooted on a
   <code>select</code> element and has attributes and methods that
   manipulate that element's descendants.</p>
 
   <pre class="idl">[Callable=<span title="dom-HTMLOptionsCollection-namedItem">namedItem</span>]
 interface <dfn>HTMLOptionsCollection</dfn> {
            attribute unsigned long <span title="dom-HTMLOptionsCollection-length">length</span>;
   [IndexGetter] <span>HTMLOptionElement</span> <span title="dom-HTMLOptionsCollection-item">item</span>(in unsigned long index);
   [NameGetter] Object <span title="dom-HTMLOptionsCollection-namedItem">namedItem</span>(in DOMString name);
-  void <span title="dom-HTMLOptionsCollection-add">add</span>(in <span>HTMLElement</span> element, in <span>HTMLElement</span> before);
+  void <span title="dom-HTMLOptionsCollection-add">add</span>(in <span>HTMLElement</span> element, [Optional] in <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);
 };</pre>
 
   <dl class="domintro">
 
    <dt><var title="">collection</var> . <code title="dom-HTMLOptionsCollection-length">length</code> [ = <var title="">value</var> ]</dt>
    <dd>
     <p>Returns the number of elements in the collection.</p>
     <p>When set to a smaller number, truncates the number of <code>option</code> elements in the corresponding container.</p>
@@ -6035,30 +6035,30 @@ interface <dfn>HTMLOptionsCollection</dfn> {
    </dd>
 
    <dt><var title="">element</var> = <var title="">collection</var> . <code title="dom-HTMLOptionsCollection-item">namedItem</code>(<var title="">name</var>)</dt>
    <dt><var title="">collection</var>[<var title="">name</var>]</dt>
    <dd>
     <p>Returns the item with ID or <code title="attr-option-name">name</code> <var title="">name</var> from the collection.</p>
     <p>If there are multiple matching items, then a <code>NodeList</code> object containing all those elements is returned.</p>
     <p>Returns null if no element with that ID could be found.</p>
    </dd>
 
-   <dt><var title="">collection</var> . <code title="dom-HTMLOptionsCollection-add">add</code>(<var title="">element</var>, <var title="">before</var>)</dt>
+   <dt><var title="">collection</var> . <code title="dom-HTMLOptionsCollection-add">add</code>(<var title="">element</var> [, <var title="">before</var> ] )</dt>
    <dd>
     <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>
     <p>The <var title="">before</var> argument can be a number, in
     which case <var title="">element</var> is inserted before the item
     with that number, or an element from the collection, in which case
     <var title="">element</var> is inserted before that element.</p>
-    <p>If <var title="">before</var> is null or a number out of range,
-    then <var title="">element</var> will be added at the end of the
-    list.</p>
+    <p>If <var title="">before</var> is omitted, null, or a number out
+    of range, then <var title="">element</var> will be added at the
+    end of the list.</p>
     <p>This method will throw a <code>HIERARCHY_REQUEST_ERR</code>
     exception if <var title="">element</var> is an ancestor of the
     element into which it is to be inserted. If <var
     title="">element</var> is not an <code>option</code> or
     <code>optgroup</code> element, then the method does nothing.</p>
    </dd>
 
   </dl>
 
   <div class="impl">
@@ -36273,21 +36273,21 @@ interface <dfn>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
            attribute boolean <span title="dom-select-multiple">multiple</span>;
            attribute DOMString <span title="dom-fe-name">name</span>;
            attribute boolean <span title="dom-select-size">size</span>;
 
   readonly attribute DOMString <span title="dom-select-type">type</span>;
 
   readonly attribute <span>HTMLOptionsCollection</span> <span title="dom-select-options">options</span>;
            attribute unsigned long <span title="dom-select-length">length</span>;
   [IndexGetter] any <span title="dom-select-item">item</span>(in DOMString name);
   [NameGetter] any <span title="dom-select-namedItem">namedItem</span>(in DOMString name);
-  void <span title="dom-select-add">add</span>(in <span>HTMLElement</span> element, in <span>HTMLElement</span> before);
+  void <span title="dom-select-add">add</span>(in <span>HTMLElement</span> element, [Optional] in <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);
 
   readonly attribute <span>HTMLCollection</span> <span title="dom-select-selectedOptions">selectedOptions</span>;
            attribute long <span title="dom-select-selectedIndex">selectedIndex</span>;
            attribute DOMString <span title="dom-select-value">value</span>;
 
   readonly attribute boolean <span title="dom-cva-willValidate">willValidate</span>;
   readonly attribute <span>ValidityState</span> <span title="dom-cva-validity">validity</span>;
   readonly attribute DOMString <span title="dom-cva-validationMessage">validationMessage</span>;
@@ -36476,30 +36476,32 @@ interface <dfn>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
    </dd>
 
    <dt><var title="">element</var> = <var title="">select</var> . <code title="dom-select-item">namedItem</code>(<var title="">name</var>)</dt>
    <dt><var title="">select</var>[<var title="">name</var>]</dt>
    <dd>
     <p>Returns the item with ID or <code title="attr-option-name">name</code> <var title="">name</var> from the <span title="concept-select-option-list">list of options</span>.</p>
     <p>If there are multiple matching items, then a <code>NodeList</code> object containing all those elements is returned.</p>
     <p>Returns null if no element with that ID could be found.</p>
    </dd>
 
-   <dt><var title="">select</var> . <code title="dom-select-add">add</code>(<var title="">element</var>, <var title="">before</var>)</dt>
+   <dt><var title="">select</var> . <code title="dom-select-add">add</code>(<var title="">element</var> [, <var title="">before</var> ])</dt>
    <dd>
     <p>Inserts <var title="">element</var> before the node given by <var title="">before</var>.</p>
     <p>The <var title="">before</var> argument can be a number, in
     which case <var title="">element</var> is inserted before the item
-    with that number, or an element from the <span title="concept-select-option-list">list of options</span>, in which case
-    <var title="">element</var> is inserted before that element.</p>
-    <p>If <var title="">before</var> is null or a number out of range,
-    then <var title="">element</var> will be added at the end of the
-    list.</p>
+    with that number, or an element from the <span
+    title="concept-select-option-list">list of options</span>, in
+    which case <var title="">element</var> is inserted before that
+    element.</p>
+    <p>If <var title="">before</var> is omitted, null, or a number out
+    of range, then <var title="">element</var> will be added at the
+    end of the list.</p>
     <p>This method will throw a <code>HIERARCHY_REQUEST_ERR</code>
     exception if <var title="">element</var> is an ancestor of the
     element into which it is to be inserted. If <var
     title="">element</var> is not an <code>option</code> or
     <code>optgroup</code> element, then the method does nothing.</p>
    </dd>
 
    <dt><var title="">select</var> . <code title="dom-select-selectedOptions">selectedOptions</code></dt>
 
    <dd>

|