Bug 10734 - HTMLOptionElement should not allow setting the text and index attributes
Summary: HTMLOptionElement should not allow setting the text and index attributes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-04 15:39 PDT by Sam Weinig
Modified: 2007-10-29 00:33 PDT (History)
1 user (show)

See Also:


Attachments
proposed patch (4.40 KB, patch)
2007-10-28 06:28 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.