[whatwg] getElementsByClassName()

ROBO Design robodesign at gmail.com
Fri Feb 3 05:56:31 PST 2006


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



More information about the whatwg mailing list