Closed Bug 198433 Opened 21 years ago Closed 21 years ago

"setting a property that has only a getter" error setting text property of OPTION object

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.4alpha

People

(Reporter: shakahshakah, Unassigned)

References

Details

(Keywords: regression)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4a) Gecko/20030319
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4a) Gecko/20030319

The JavaScript console shows the error mentioned in the summary when setting the
text property of an OPTION object (inside a SELECT object) in the following HTML
(error is reported on line 22):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>OPTION Javascript bug</title>
</head>

<body>
<h3>OPTION Javascript bug</h3>

<p>
<select ID="the_listbox" SIZE=10>
  <option VALUE="0" SELECTED>default option</option>
</select>

<script TYPE="text/javascript" LANGUAGE="JavaScript1.2">
<!--
  var theListbox = document.getElementById("the_listbox") ;
  theListbox.length = 10 ;

  var n ;
  for(n=0; n<10; ++n) {
    theListbox.options[n].text = "Item Text " + n ;
    theListbox.options[n].value = "iv_" + n ;
  }
  theListbox.selectedIndex = 5 ;
//-->
</script>

</body>
</html>

Reproducible: Always

Steps to Reproduce:
load the HTML mentioned in Details.

Actual Results:  
"setting a property that has only a getter" error in JavaScript console,
attributed to line 22.

Expected Results:  
Filled the SELECT listbox with 10 items.

Seems to have worked fine until this week's nightlies, though I might be off by
a week or so.
sample HTML page
Not JS engine.
Assignee: rogerl → dom_bugs
Component: JavaScript Engine → DOM Core
QA Contact: pschwartau → desale
The fact that it ever worked was a bug.  The property is readonly in both DOM1
(http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html#ID-70901257)
and DOM2
(http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-70901257).
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Reopening, this is actually a regression. We used to support this, and we
intended to still do, that's why nsIDOMNSHTMLOptionElement was created, but that
was added to the wrong place in nsDOMClassInfo. Patch coming up.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: regression
OS: Windows 2000 → All
Priority: -- → P2
Hardware: PC → All
Target Milestone: --- → mozilla1.4alpha
Comment on attachment 117884 [details] [diff] [review]
Make nsIDOMNSHTMLOptionElement shadow properties in nsIDOMHTMLOptionElement instead of vise versa.

Add a nice clear comment that the order matters, please?
Attachment #117884 - Flags: superreview+
*** Bug 198424 has been marked as a duplicate of this bug. ***
Attachment #117884 - Flags: superreview?(bzbarsky)
Attachment #117884 - Flags: review?(fabian)
Attachment #117884 - Flags: superreview?(bzbarsky)
Comment on attachment 117884 [details] [diff] [review]
Make nsIDOMNSHTMLOptionElement shadow properties in nsIDOMHTMLOptionElement instead of vise versa.

woops sorry for not catching that earlier
Attachment #117884 - Flags: review?(fabian) → review+
FIXED.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago21 years ago
Resolution: --- → FIXED
Component: DOM: Core → DOM: Core & HTML
QA Contact: desale → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: