[whatwg] .tags on HTMLCollections

Ian Hickson ian at hixie.ch
Tue Jul 28 14:48:52 PDT 2009

On Mon, 13 Jul 2009, Boris Zbarsky wrote:
> Ian just pointed out to me that his current draft requires 
> HTMLCollections to implement a tags() method (which seems to do a filter 
> by tagName on the contents of the collection).
> As far as I can tell, IE, Webkit, and Opera implement this; Gecko does 
> not.  I was wondering whether any of the Webkit or Opera folks could 
> comment on _why_ they implement this?  I haven't seen any uses of this 
> in the wild (outside document.all.tags, but document.all doesn't behave 
> like a normal HTMLCollection in all sorts of other ways either).
> I'd rather be specifying (and implementing) a smaller DOM API, if that's 
> all that's needed for actual web compat....

On Tue, 14 Jul 2009, Maciej Stachowiak wrote:
> Support for HTMLCollection.tags() in WebKit predates the fork from 
> KHTML. So we don't know why it was originally added.

On Tue, 14 Jul 2009, Boris Zbarsky wrote:
> I guess the other question is whether you feel it's worth keeping...

On Tue, 14 Jul 2009, Maciej Stachowiak wrote:
> I don't know of a reason it's needed for collections other than 
> document.all. But it also doesn't seem harmful and I can't say 
> definitively whether it helps anything. I wouldn't object to removing it 
> from the spec, but we probably wouldn't remove it from WebKit short of 
> evidence that it's actually harmful.
> Perhaps Opera people can shed more light on the matter.

On Thu, 23 Jul 2009, Anne van Kesteren wrote:
> From what I heard so far it is there because of document.all. If 
> document.all does indeed need to return a separate object as HTML5 
> suggests we can probably remove it from HTMLCollection in due course.

I haven't removed HTMLCollection.tags yet, since it appears to be 
implemented by most browsers. If we can get Opera and WebKit to remove 
support, then I'll remove it from the spec.

On Thu, 23 Jul 2009, Boris Zbarsky wrote:
> Given that the namedItem behavior of document.all is different from the 
> namedItem behavior of HTMLCollection, I don't see how document.all could 
> possibly be a general HTMLCollection....

On Fri, 24 Jul 2009, Anne van Kesteren wrote:
> They are indeed distinct, but do share the same interface name in Opera 
> the moment, as far as I can tell... In any case, my point was that we'd 
> be ok with removing the tags member from HTMLCollection in due course.

On Fri, 24 Jul 2009, Boris Zbarsky wrote:
> Oh, the _name_ is shared in Gecko too.  Just not anything else.  ;)

Right now the HTML5 spec calls the document.all HTMLCollection 
"HTMLAllCollection", since I have no way to override the name, and I can't 
have two names the same. I'm not sure what the prototype of document.all 
is if it's not the same as document.images... in fact this whole area is 
quite confusing to me. So I haven't done any the confusingness and just 
made them distinct.

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