bfults at gmail.com
Thu Feb 2 23:48:20 PST 2006
I see this is still an open issue. Is this now implemented as #1
(space-delimited class names to match)?
I suggest either going with the space-delimited approach (as it's
language-agnostic and well-defined at least) or with Aankhen's
suggestion of a single array argument.
I think the latter is better and more intuitive in design, however.
The function should take a single argument at all times.
If the argument is a string, that string is used as a single class
name and matched against the elements in the document.
Else if the argument is an array, each element of the array is taken
as a string and will be treated as a class name.
The elements which have all of the class names existing in the array
will match and be returned in the NodeList.
 - http://whatwg.org/specs/web-apps/current-work/#getelementsbyclassname
On 9/5/05, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> Jim Ley wrote:
> > On 9/5/05, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> >>I may not be understanding what you mean, but if optional parameters
> >>aren't language independant, shouldn't it be defined in a more language
> >>independant way, so that any non-ECMAScript languages can still
> >>implement this?
> > Yes, DOM currently is language agnostic, however the optional
> > className parameters aren't compatible with languages which can't do
> > that. So as defined now getElementsByClassName would not manage to do
> > that.
> In that case, should it be redefined as:
> NodeList getElementsByClassName(in DOMString classNames);
> where classNames is a string of space separated class names? That would
> be just as easy to implement and would work with languages that don't
> support optional parameters.
> Lachlan Hunt
More information about the whatwg