RobG wrote:
[DOM 2 HTML Specification]
But it does say the length attribute of HTMLCollection is
read-only.
Yes, that hasn't changed. That property is read-only in both DOM 1 and 2.
To me, it would be handy if at that point the spec
pointed out that there are exceptions to the rule.
But there aren't any exceptions. In DOM 1, the HTMLSelectEleme nt
interface used HTMLCollection for the options collection. Therefore,
under DOM 1, you couldn't modify the property. Once the working group
realised that DOM 0 allowed hosts to treat the options collection like
an array (in that changing the length property modified the array),
they introduced a new interface: HTMLOptionsColl ection. It is exactly
the same as the HTMLCollection interface except that the length
property is read/write. The other change was that the
HTMLSelectEleme nt interface itself was modified to make the length
property there read/write, too.
If you look at the respective interfaces, the specification marks
changes with the text "Modified in DOM Level 2" and "introduced in DOM
Level 2". The specific details are listed in Appendix A.
Finally, note that implementations are allowed to raise an exception
if the length attributes are modified, presumably to allow easier
migration from DOM 1 to DOM 2.
[snip]
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.