RESOLVED FIXED 10472
REGRESSION: "add" method of <select> object does not put the <option> object in the correct position
https://bugs.webkit.org/show_bug.cgi?id=10472
Summary REGRESSION: "add" method of <select> object does not put the <option> object ...
Sebastian Celis
Reported 2006-08-17 13:39:06 PDT
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
Attachments
Test case reduction (2.56 KB, text/html)
2006-08-17 13:40 PDT, Sebastian Celis
no flags
Reset the options collection info for non-in-document <select>s (3.94 KB, patch)
2007-01-19 03:02 PST, mitz
no flags
Reset the options collection info for non-in-document <select>s (3.94 KB, patch)
2007-01-19 04:52 PST, mitz
darin: review+
Sebastian Celis
Comment 1 2006-08-17 13:40:15 PDT
Created attachment 10108 [details] Test case reduction
Stephanie Lewis
Comment 2 2006-11-06 20:48:53 PST
radar 4823090
mitz
Comment 3 2007-01-19 03:02:45 PST
Created attachment 12553 [details] Reset the options collection info for non-in-document <select>s
David Kilzer (:ddkilzer)
Comment 4 2007-01-19 04:14:27 PST
(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?
mitz
Comment 5 2007-01-19 04:52:58 PST
Created attachment 12556 [details] Reset the options collection info for non-in-document <select>s s/middle/first/ Thanks for pointing this out!
Darin Adler
Comment 6 2007-01-19 08:34:26 PST
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
Sam Weinig
Comment 7 2007-01-21 09:37:23 PST
Landed in r19011.
Note You need to log in before you can comment on or make changes to this bug.