Closed Bug 194121 Opened 22 years ago Closed 22 years ago

javascript can't add options

Categories

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

x86
Windows NT
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 182279

People

(Reporter: ddyer, Assigned: jst)

References

Details

(Whiteboard: INVALID?)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021212 Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021212 The attached HTML uses javascript to modify the number of days in a month presented in a pulldown to an appropriate value. It successfully makes the number of days less for months such as february, but fails to subsequently make the list longer for months such as march. Reproducible: Always Steps to Reproduce: 1. open the page 2. try various values for "month" 3. note that the number of days can't be increased after you have chosen february.
Attached file sample javascript/html
Error: uncaught exception: [Exception... "Not enough arguments [nsIDOMHTMLSelectElement.add]" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://bugzilla.mozilla.org/attachment.cgi?id=114926&action=view :: ChangeOptionDays :: line 43" data: no]
Assignee: rogerl → jst
Component: JavaScript Engine → DOM HTML
QA Contact: pschwartau → desale
http://lxr.mozilla.org/seamonkey/source/dom/public/idl/html/nsIDOMHTMLSelectElement.idl 57 void add(in nsIDOMHTMLElement element, 58 in nsIDOMHTMLElement before); DaysObject.add(NewOption); http://xml.apache.org/xerces2-j/javadocs/api/org/w3c/dom/html/HTMLSelectElement.html void add(HTMLElement element, HTMLElement before) Add a new element to the collection of OPTION elementsfor this SELECT.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
v.
Status: RESOLVED → VERIFIED
the spec doesn't provide any way to append at the end, which seems like an obvious requirent. In mozilla, the inhereted method appendChild seems to work. However, note on compatability, in IE "add" with one argument works, and "appendChild" does not. In the interests of compatability, mozilla should treat one argument add as append.
Mozilla *does* treat one argument options.add() as append. The standard way to append an option is to use either select.appendChild() or select.add(option, null) (note, not options.add()).
I'm simply aguing that as a pragmatic matter, since the evil IE accepts option.add, mozilla should also. Otherwise, people will think mozilla is broken, and few will be interested that you're following the spec and IE is not. The goal is to make Mozilla attractive, both to endusers and javascript writers.
Status: VERIFIED → UNCONFIRMED
Resolution: INVALID → ---
Whiteboard: INVALID?
True in general, but you can only take that so far. We do not have the resources to emulate everything IE does, we'll do the things that matter, show us that a non-trivial number of real sites are broken because of this bug and we'll reconsider. INVALID until then.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → INVALID
*** Bug 279230 has been marked as a duplicate of this bug. ***
*** Bug 306201 has been marked as a duplicate of this bug. ***
Resolution: INVALID → DUPLICATE
Component: DOM: HTML → 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: