<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - REGRESSION (r178097): HTMLSelectElement.add(option, undefined) prepends option to the list of options; should append to the end of the list of options"
   href="https://bugs.webkit.org/show_bug.cgi?id=146566#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - REGRESSION (r178097): HTMLSelectElement.add(option, undefined) prepends option to the list of options; should append to the end of the list of options"
   href="https://bugs.webkit.org/show_bug.cgi?id=146566">bug 146566</a>
              from <span class="vcard"><a class="email" href="mailto:cdumez&#64;apple.com" title="Chris Dumez &lt;cdumez&#64;apple.com&gt;"> <span class="fn">Chris Dumez</span></a>
</span></b>
        <pre>Relevant specs:
<a href="https://html.spec.whatwg.org/multipage/forms.html#dom-select-add">https://html.spec.whatwg.org/multipage/forms.html#dom-select-add</a>

which points to:
<a href="https://html.spec.whatwg.org/multipage/infrastructure.html#dom-htmloptionscollection-add">https://html.spec.whatwg.org/multipage/infrastructure.html#dom-htmloptionscollection-add</a>

which says in this case to call the DOM insertBefore() method on the parent node, with element as the first argument and null (in our case) as the second argument.

<a href="https://dom.spec.whatwg.org/#dom-node-insertbefore">https://dom.spec.whatwg.org/#dom-node-insertbefore</a>
-&gt;
<a href="https://dom.spec.whatwg.org/#concept-node-insert">https://dom.spec.whatwg.org/#concept-node-insert</a>

&quot;
For each newNode in nodes, in tree order, run these substeps:
1. Insert newNode into parent before child or at the end of parent if child is null.
2. Run the insertion steps with newNode.
&quot;

Ok, so even though it is hard to follow, the spec does say to insert &quot;at the end of parent if child is null&quot;.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>