Bug 15235

Summary: Options can not be removed from a Select element with OptGroup's using JavaScript
Product: WebKit Reporter: diovieno@perseus..com <diovieno>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap
Priority: P2 Keywords: InRadar
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
test case
none
First attempt mitz: review+

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>
    <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>
    </optgroup>
</select>

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

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

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 :)
Cheers,

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

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

http://trac.webkit.org/projects/webkit/changeset/25668

Does this need a radar?

Comment 6 David Kilzer (:ddkilzer) 2007-09-20 04:00:10 PDT
<rdar://problem/5494123>