jonas at sicking.cc
Mon Jul 9 19:55:53 PDT 2007
Lachlan Hunt wrote:
> 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 , 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.
I agree with Simon here. Allowing arrays to be passed in doesn't add any
extra value and complicates the implementation significantly. I think
that the by far most common case is going to be passing a single class
name, so adding multiple ways of passing multiple class names seems like
More information about the whatwg