[whatwg] HTMLCollection and HTMLAllCollection suggestion
Ian Hickson
ian at hixie.ch
Tue Jul 27 16:42:27 PDT 2010
On Sat, 3 Apr 2010, Perry Smith wrote:
>
> HTMLCollection has a namedItem method that returns either null or one
> object.
>
> HTMLAllCollection has a namedItem method that returns either null, one
> object, or a collection of objects.
>
> I'm a Rails freak and one of the things that they do which I love is foo
> returns an item and foos returns a list of items. The unconscious
> benefit of this I believe is huge.
>
> My suggestion is to have namedItem always return either null or 1
> object.
>
> And have namedItems always return a collection. We can debate whether
> it is better to return null or an empty collection. I prefer the latter
> myself. Then I can always feed it to an iterator.
Unfortunately this is all stuff that was decided over a decade ago, we
can't really change it at this point.
On Sat, 3 Apr 2010, David Flanagan wrote:
>
> But no one actually invokes namedItem()--they just use a regular
> property access expression on an HTMLAllCollection. namedItem() is left
> over from the strange days when the W3C was specifying Java APIs for
> working with XML instead of JavaScript APIs for HTML!
Indeed.
On Sun, 4 Apr 2010, Perry Smith wrote:
>
> Hmm. I was wondering. The pop up boxes on the side did not have any
> icons in them so I thought no one had implemented them.
They aren't always entirely up to date. If anyone wants to help maintain
them please feel free to do so!
> Can you give me an example of "regular property access expression on an
> HTMLAllCollection" ? I can't figure out what you are referring to.
On Mon, 5 Apr 2010, David Flanagan wrote:
>
> I think the only HTMLAllCollection is the deprecated document.all. By
> regular property access expression, I mean something like:
>
> document.all.foo
>
> or
>
> document.all["foo"]
>
> instead of:
>
> document.all.namedItem("foo")
Indeed.
On Tue, 6 Apr 2010, Perry Smith wrote:
>
> I'm confused by the spec at this point. The title for section 13 is
> "obsolete features" but then 13.3 is "Requirements" and indeed 13.3.4
> has features not yet implemented but considered deprecated by David (who
> I assume knows what he is talking about).
Obsolete features still have to be implemented by browsers so that they
can render yesterday's Web pages.
> I test a little bit in firefox and document.all doesn't work. So I look
> and see that Firefox is developing it.
On Tue, 6 Apr 2010, Boris Zbarsky wrote:
>
> Sure it does:
>
> data:text/html,<body><script>alert(document.all.length);</script>
>
> > Is the HTMLAllCollection coming or going?
>
> Neither. It's here; no one is planning to add new features to it, web
> pages are discouraged from using it.
Indeed.
On Tue, 6 Apr 2010, Perry Smith wrote:
>
> Ok... sorry if I've wasted peoples time.
No worries!
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list