W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2007

[whatwg] getElementsByClassName

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Sat, 07 Jul 2007 00:37:34 +1000
Message-ID: <468E53AE.70505@lachy.id.au>
Simon Pieters wrote:
> getElementsByClassName is defined to take an array of strings as 
> argument. What exactly is an array? A native ECMAScript array, or 
> anything with a 'length' property and the properties '0' -> length-1? Is 
> a DOMTokenList an "array" that can be passed to gEBCN?

It could be defined to accept either a space separated string or an 
array.  Using the [Overloads] extended attributed defined in the 
Language Bindings for DOM Specifications draft [1], it could be defined 
like this:

NodeList getElementsByClassName(in DOMString classNames);
      NodeList getElementsByClassNameArray(in DOMString[] classNames);

For ECMAScript, that effectively means that getElementsByClassName() can 
be called with either a space separated string of class names or an array.


Lachlan Hunt
Received on Friday, 6 July 2007 07:37:34 UTC

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