[whatwg] getElementsByClassName()

I think variable number of arguments for that function may be cause of  
many problems.

As far as I'm aware W3C DOM never uses functions with variable number of  
arguments, so design of getElementsByClassName() stands out.
Functions with variable number of arguments are problematic in some  
programming languages, and because of that W3C may not want to include  
such method in future DOM specfications.
Such design forbids any extensibility as well - it won't be possible to  
add new optional parameters to that function.

I suggest that getElementsByClassName() should take only one parameter:  
string of space-separated class names. This may simplify implementation,  
because same algorithm can be used to get list of class names from input  
and from elements.

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.

-- 
regards, Kornel Lesinski

Received on Sunday, 4 September 2005 05:56:24 UTC