Bug 10734

Summary: HTMLOptionElement should not allow setting the text and index attributes
Product: WebKit Reporter: Sam Weinig <sam>
Component: DOMAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: ap
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
proposed patch darin: review+

Description Sam Weinig 2006-09-04 15:39:13 PDT
According to the DOM spec, both the "text" and "index" attributes of the HTMLOptionElement should be readonly (http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-70901257).  We currently allow setting for both, but throw an exception when setting the "index" element.

One issue may be that the DOM Level 1 (Version 1.0) spec says that the "index" element shouldn't be readonly, and that fact is noted in the IDL with a FIXME that states, "FIXME: We disallow setting in violation of DOM 1 HTML".
Comment 1 Alexey Proskuryakov 2007-10-28 06:28:26 PDT
Created attachment 16913 [details]
proposed patch

HTMLOptionElement.index is read-only in IE and DOM (both DOM 2 and DOM 1 Second Edition), so if I'm not missing something, Firefox is wrong to raise an exception.

HTMLOptionElement.text is settable in both IE and Firefox, so I don't think that we should change this.
Comment 2 Darin Adler 2007-10-28 14:22:06 PDT
Comment on attachment 16913 [details]
proposed patch

Why not add a newline at the end of the test file?

Shouldn't you also remove HTMLOptionElement::setIndex from HTMLOptionElement.cpp/h?

Otherwise, r=me
Comment 3 Alexey Proskuryakov 2007-10-29 00:33:26 PDT
(In reply to comment #2)
> Why not add a newline at the end of the test file?

Done.

> Shouldn't you also remove HTMLOptionElement::setIndex from
> HTMLOptionElement.cpp/h?

Done.

> Otherwise, r=me

Committed revision 27217.