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

[whatwg] getElementsByClassName()

From: BÁRTHÁZI András <andras@barthazi.hu>
Date: Wed, 08 Feb 2006 07:02:54 +0100
Message-ID: <43E9898E.1040603@barthazi.hu>

James Graham wrote:
> Lachlan Hunt wrote:
>> James Graham wrote:
>>> Also I would be surprised if there weren't multiple implementations 
>>> of getElementsByClassname floating around in javascript libraries. So 
>>> you can't really call it unimplemented.
>> While there are many JavaScript implementations (I even wrote one 
>> myself a few months ago), all the custom JS implementations count for 
>> exactly zero native implementations in UAs, which is what really counts.
> But it suggests that its not hard to implement, which was my (poorly 
> made) point.

It's not hard to implement in JavaScript, but there's no an effective 
way to do it. You have to get all the elements of the page, and then 
check each if it has a specific className. And if you want to do it in 
the right way, you have to split clssNames by spaces, and then check, if 
it meets with the specified className.

Received on Tuesday, 7 February 2006 22:02:54 UTC

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