HTMLSelectElement and HTMLOptionsCollection add() method should support index as second argument.
https://bugs.webkit.org/show_bug.cgi?id=139179

Patch by Shivakumar JM <shiva.jm@samsung.com> on 2015-01-07
Reviewed by Darin Adler.

Source/WebCore:

HTMLSelectElement and HTMLOptionsCollection add() method should support index as second argument as per specification
http://www.w3.org/html/wg/drafts/html/master/forms.html#the-select-element.
Also this matches the behavior of Chrome and FireFox.

Tests: fast/dom/HTMLSelectElement/add.html
       fast/dom/HTMLSelectElement/options-collection-add.html

* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::JSHTMLOptionsCollection::add): Deleted.
* html/HTMLOptionsCollection.cpp:
(WebCore::HTMLOptionsCollection::add):
* html/HTMLOptionsCollection.h:
* html/HTMLOptionsCollection.idl:
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::add):
* html/HTMLSelectElement.h:
* html/HTMLSelectElement.idl:

LayoutTests:

* fast/dom/HTMLSelectElement/add-expected.txt: Added.
* fast/dom/HTMLSelectElement/add.html: Added.
* fast/dom/HTMLSelectElement/options-collection-add-expected.txt: Added.
* fast/dom/HTMLSelectElement/options-collection-add.html: Added.
* fast/dom/HTMLSelectElement/select-add-optgroup-expected.txt:
* fast/dom/HTMLSelectElement/select-add-optgroup.html:
* fast/dom/incompatible-operations-expected.txt:
* fast/dom/incompatible-operations.html:
* js/dom/script-tests/select-options-add.js:
* js/dom/select-options-add-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@178097 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed