W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Re: DOM collections index out of bounds and JavaScript.

From: Scott Shattuck <idearat@mindspring.com>
Date: Tue, 19 Oct 2010 11:47:10 -0600
Message-ID: <AANLkTi=8AiBiJVfbkBeCxdFZdXWVg2nfjWLX-NV-FnhR@mail.gmail.com>
To: Erik Arvidsson <arv@chromium.org>
Cc: Garrett Smith <dhtmlkitchen@gmail.com>, Anne van Kesteren <annevk@opera.com>, Cameron McCormack <cam@mcc.id.au>, public-webapps@w3.org
Seems to me that when you access a slot that in some sense "doesn't exist"
it should return undefined, not null. There are plenty of semantic cases (is
this attribute defined but currently unset, or not defined at all) where the
difference can be significant. I realize not all languages support the
distinction, but JS does and it's actually a useful feature.


On Tue, Oct 19, 2010 at 11:06 AM, Erik Arvidsson <arv@chromium.org> wrote:

> On Tue, Oct 19, 2010 at 09:50, Garrett Smith <dhtmlkitchen@gmail.com>
> wrote:
> ...
> > CSSStyleDeclaration. What about the other "collection" objects? HTML5
> > says that collections are now callable and specifies that "indexed"
> > property access on collections returns null. But what about other APIs
> > such as NodeList, NamedNodeMap, CSSRuleList, and StyleSheetList?
> Almost all of them are defined to return null. Actually
> CSSStyleDeclaration is the only exception I could find in WebCore
> sources.
> > Changing the wording for each collection would be painfully
> > repetitious, involving a spec author for each spec. There is not any
> > super interface collection defined that also defines `item`,
> > callability, property access, etc. though if there were then all
> > collection type objects inherit from that and would avoid shotgun
> > surgery. That would seem to be something for DOM 4 core, if such a
> > thing is to be written.
> WebIDL has a section for sequence but it is not fleshed out yet.
> erik
Received on Tuesday, 19 October 2010 17:47:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:13 UTC