[whatwg] getElementsByClassName()

Hi,

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.

Bye,
   Andras

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