W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2006

[whatwg] getElementsByClassName()

From: Jim Ley <jim.ley@gmail.com>
Date: Fri, 3 Feb 2006 14:30:54 +0000
Message-ID: <851c8d310602030630y6db4b1bah31ee5887ccaf25cf@mail.gmail.com>
On 2/3/06, Gervase Markham <gerv at mozilla.org> wrote:
> Jim Ley wrote:
> >  the document of course shows no use cases at all.
>
> Is there some doubt that the ability to tag an arbitrary set of elements
> and later easily get an array of those elements is a useful feature for
> web development?

I've yet to hear of an actual reason to do so, people keep saying it
seems useful...

> If you would like use cases, I present all of the web pages currently
> using a JS implementation of getElementsByClassName based on
> getElementsByTagName("*") and some manual class name inspection logic.

Yes, but they're all using it to attach events to every one of the
class, which is why you have to look at use cases, the reason they're
doing it is not because getElementsByClassName is missing, but because
addEventListenerToClass or -moz-binding etc. are missing.

It's the classic mistake of looking at making the workarounds easier,
when you should be looking at making the underlying use easier.

Jim.
Received on Friday, 3 February 2006 06:30:54 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:26 UTC