W3C home > Mailing lists > Public > www-dom@w3.org > October to December 1998

Re: HTMLOptionElement.selected vs defaultSelected

From: David Williams <djw@avantgo.com>
Date: Fri, 27 Nov 1998 13:18:55 -0800
Message-ID: <365F173F.588C6BD9@avantgo.com>
To: John Whelan <whelan@itp.unibe.ch>
CC: www-dom@w3.org
John Whelan posted on this topic about two weeks ago, and I have exactly  the
same query. As John seemed to nail the argument exactly, I'll just quote his

John Whelan wrote:
> I'm confused about the selected and defaultSelected attributes of the
> HMTLOptionElement interface in the the DOM Level One spec
> http://www.w3.org/TR/REC-DOM-Level-1/level-one-html.html#ID-70901257
> According to the spec, defaultSelected is read-write and "Stores the
> initial value of the selected attribute", while selected is read-only
> and "Means that this option is initially selected.  See the selected
> attribute definition in HTML 4.0."
> Now, with the exception of the definition given for defaultSelected,
> this seems to be reversed from the JavaScript definitions of these two
> attributes.  In JavaScript, defaultSelected is read-only, and is set
> by the value of the OPTION element's SELECTED attribute, while
> selected is read-write, and determines whether the option is selected
> (either by the user or by a scripting event).
> The DOM spec appears to be in error (or at least nonsensical) here:
> if selected is a read-only attribute declaring whether the Option is
> initially selected, then what's the point of having a defaultSelected
> attribute which stores its initial value (and is read-write, to boot)?
>                                         John T. Whelan
>                                         whelan@iname.com
>                                         http://www.slack.net/~whelan/

I agree that the DOM spec seems counter intuitive, and at odds with
JavaScript. Can we assume it's just a typo?

Received on Friday, 27 November 1998 16:18:12 UTC

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