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

[whatwg] getElementsByClassName()

From: Kornel Lesinski <kornel@ideadesigners.com>
Date: Sun, 04 Sep 2005 13:56:24 +0100
Message-ID: <op.swkwwapxjj9hi8@osx.local>

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

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