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

[whatwg] getElementsByClassName()

From: ROBO Design <robodesign@gmail.com>
Date: Fri, 03 Feb 2006 15:56:31 +0200
Message-ID: <op.s4eg0hd4mapogm@localhost.localdomain>
On Fri, 03 Feb 2006 15:39:26 +0200, Gervase Markham <gerv at mozilla.org>  
wrote:

> ROBO Design wrote:
<...>
>
> Well, not according to the current spec, which says:
>
>> 1. Should it return *all* elements which have *all* the class names  
>> wanted?
>
> this one. Of course, you may disagree with the spec.

I'd personally like this:

getElementsByClassNames(["array", "of","class","names"], bool any)

if any = true then get all elements that have any of the class names  
provided, otherwise get all elements that have *all* class names provided.

>> 4. Should the order matter?
>
> No, because class name ordering does not matter in the source or in CSS.

True, but Ric has made an interesting point about the order of class  
names, which does actually matter.

Do we want getElementsByClassNames() to work as "the final page render" or  
just "logically"? I don't even know how to say it, but here's the idea:

You have the foo bar example provided by Ric, in which Fred and Wilma  
paragraphs are blue, and Barney is red.

Do you want to be able to make the distinction between Fred, Wilma and  
Barney with getElementsByClassNames(["foo", "bar"]) ? If the order doesn't  
matter ... you can't.

This is getting way beyond control.

<...>
>
> That turns the function into something which is dependent on CSS rather
> than just dependent on the markup language. That is a reasonably large
> change in scope IMO.

True.

-- 
http://www.robodesign.ro
ROBO Design - We bring you the future
Received on Friday, 3 February 2006 05:56:31 UTC

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