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

[whatwg] getElementsByClassName()

From: Dean Edwards <dean@edwards.name>
Date: Tue, 24 Oct 2006 02:40:27 +0100
Message-ID: <453D6F0B.6010203@edwards.name>
Ian Hickson wrote:
> On Mon, 23 Oct 2006, Dean Edwards wrote:
>> Personally, I prefer a comma delimited list. Passing an array seems 
>> yukky.
> 
> Really? I always thought the comma-separated argument to window.open() was 
> one of the ugliest APIs ever...
> 

This isn't the same thing. We are faking varargs so whatever we do is 
going to look a bit ugly. Nine times out of ten this method will be 
called with one argument:

var menus = document.getElementsByClassName("menu");

That is much more intuitive for the most common case.

> 
>> Are there any problems with passing a JavaScript array to a DOM method? 
>> Does it cast to a DOMArray or something? What about other platforms?
> 
> It's an array. Most languages support arrays. Why would there be a 
> problem?
> 

Just checking. ;-)

-dean
Received on Monday, 23 October 2006 18:40:27 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:49 UTC