W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2005

[whatwg] getElementsByClassName()

From: Kornel Lesinski <kornel@ideadesigners.com>
Date: Sun, 04 Sep 2005 18:55:49 +0100
Message-ID: <op.swlarbh0jj9hi8@idlaptop02.ideadesigners.local>
On Sun, 04 Sep 2005 17:51:43 +0100, Anne van Kesteren  
<fora at annevankesteren.nl> wrote:

>> It will also solve IMHO unclear case of getElementsByClassName("foo  
>> bar")  matching "bar foo". It would, as opposed to behavior where space  
>> is both  separator and part of class name.
>
> This is not how the CLASS attribute works. "foo bar" means the element  
> has two classes bound to it, "foo" and "bar". With your syntax,
> getElementsByClassName("bar foo") would also need to match an element  
> with "foo bar" as value for the CLASS attribute.

Sorry, that sentence might have been unclear.

In currently proposed implementation getElementsByClassName("foo bar")  
doesn't match class="bar foo", but matches class="foo bar". This implies  
that class attribute isn't just space-separated list of classes.

That's why I propose to make this function use exactly the syntax that  
class attribute uses.
getElementsByClassName("bar foo") should match class="foo bar", class="bar  
baz foo", etc.

-- 
regards, Kornel Lesinski
Received on Sunday, 4 September 2005 10:55:49 UTC

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