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

HTMLOptionElement.selected vs defaultSelected

From: John Whelan <whelan@itp.unibe.ch>
Date: Thu, 5 Nov 1998 05:41:26 -0500 (EST)
Message-Id: <199811051040.LAA18513@itp9.unibe.ch>
To: www-dom@w3.org
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/
Received on Thursday, 5 November 1998 05:43:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT