W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2002

Re: DOM2-HTML: HTMLSelectElement.add

From: Philippe Le Hegaret <plh@w3.org>
Date: 22 Mar 2002 16:18:48 -0500
To: WWW DOM <www-dom@w3.org>
Message-Id: <1016831929.840.61.camel@jfouffa>
Thomas Much wrote:
> HTMLSelectElement.add raises a DOMException(NOT_FOUND_ERR) if the "before"
> argument is not a descendant of the SELECT element. OK.
> But what happens if I try to add an element (passed in the "element"
> argument), that is not an OPTION element? Currently, add is directly
> delegated to Node.appendChild or Node.insertBefore - that is, I can add
> HEAD, IMG, FORM elements to the options array... That makes no sense.
> If the standard specifies a special operation for adding OPTIONs, it should
> deal with errors specially and raise an exception if an element other than
> OPTION is passed.
> If you want to create invalid documents you still can use the Node interface
> on the SELECT element, but the standard should not make this too ease
> IMHO...

Looking at existing implementations, Netscape does accept the element
on add. They don't do validation on this call. The element is not
returned in the list of options but does appear as a child of the
element table. IE on the other hand, does have a minimal validation in
this case and ignore the new element (ie it is a no-op in that case).
So, facing differences in implementations, we added:
This method may have no effect if the new element is not an OPTION or an

for the DOM WG.
Received on Friday, 22 March 2002 16:18:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:09 UTC