[whatwg] getElementsByClassName()

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.


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