Bug 15235 - Options can not be removed from a Select element with OptGroup's using JavaScript
Summary: Options can not be removed from a Select element with OptGroup's using JavaSc...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2007-09-18 16:17 PDT by diovieno@perseus..com
Modified: 2007-09-20 04:00 PDT (History)
1 user (show)

See Also:

test case (643 bytes, text/html)
2007-09-18 21:53 PDT, Alexey Proskuryakov
no flags Details
First attempt (3.34 KB, patch)
2007-09-19 12:21 PDT, Rob Buis
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description diovieno@perseus..com 2007-09-18 16:17:24 PDT
If you have a select element as follows

<select name="S1" id="S1">
    <optgroup label="Group 1">
      <option value="1">Option 1</option>
      <option value="2">Option 2</option>
      <option value="3">Option 3</option>
      <option value="4">Option 4</option>
    <optgroup label="Group 2">
      <option value="5">Option 5</option>
      <option value="6">Option 6</option>
      <option value="7">Option 7</option>
      <option value="8">Option 8</option>
      <option value="9">Option 9</option>

And attempt to use JavaScript to remove an option from the list

var list = document.getElementById("S1");
list.options[3] = null;

The item is not removed from the list.
No errors appear in the JavaScript Console.

If the select element does not contain optgroup's, the JavaScript works correctly.
Comment 1 Alexey Proskuryakov 2007-09-18 21:53:16 PDT
Created attachment 16320 [details]
test case

Same test as an attachment.
Comment 2 Alexey Proskuryakov 2007-09-18 21:55:03 PDT
Confirmed with shipping 10.4.10 WebKit and with r25449.
Comment 3 Rob Buis 2007-09-19 12:21:33 PDT
Created attachment 16326 [details]
First attempt

This fixes it and doesn't regress otherwise :)

Comment 4 mitz 2007-09-19 13:19:00 PDT
Comment on attachment 16326 [details]
First attempt

Comment 5 David Kilzer (:ddkilzer) 2007-09-20 03:46:55 PDT
Committed by rwlbuis  in r25668.


Does this need a radar?

Comment 6 David Kilzer (:ddkilzer) 2007-09-20 04:00:10 PDT