In certain circumstances, it seems as though selectObj.add(optionObj, selectObj.options[0]); does not actually add optionObj to the beginning of the select object. From my testing, it looks as if this bug only occurs if the selectObj is created dynamically using document.createElement("select"); The first time the "add" method is called, it works fine. On subsequent calls, the <option> objects are placed at lower positions in the <select> list. It is as if selectObj.options[0] is not updated to return the correct object after the "add" is performed. This is confirmed by calling alert(selectObj.options[0].value); after each call to the "add" method. This issue is not present in WebKit 4.19.3. I am attaching a test case reduction which demonstrates the issue. Machine Details: MacBook Pro Mac OS X 10.4.7 WebKit-SVN-r15924.dmg -- Thu Aug 17 8:00:01 GMT 2006
Created attachment 10108 [details] Test case reduction
radar 4823090
Created attachment 12553 [details] Reset the options collection info for non-in-document <select>s
(In reply to comment #3) > Created an attachment (id=12553) [edit] > Reset the options collection info for non-in-document <select>s In the layout test, there is a lastOption and a middleOption, but no firstOption. Would it make more sense to rename middleOption to firstOption?
Created attachment 12556 [details] Reset the options collection info for non-in-document <select>s s/middle/first/ Thanks for pointing this out!
Comment on attachment 12556 [details] Reset the options collection info for non-in-document <select>s Might want a comment indicating why it's not needed for selects that are in the document. Or ... could just not both with the if statement since there's no harm in resetting the collection twice. r=me
Landed in r19011.