[whatwg] getElementsByClassName
Lachlan Hunt
lachlan.hunt at lachy.id.au
Fri Jul 6 07:37:34 PDT 2007
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);
[Overloads=getElementsByClassName]
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.
[1]
http://dev.w3.org/cvsweb/~checkout~/2006/webapi/Binding4DOM/Overview.html?content-type=text/html;%20charset=utf-8#Overloads
--
Lachlan Hunt
http://lachy.id.au/
More information about the whatwg
mailing list