[whatwg] getElementsByClassName()

Jim Ley jim.ley at gmail.com
Mon Sep 5 04:18:47 PDT 2005


On 9/5/05, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
> Jim Ley wrote:
> > className = className.match(/^\s*(\S+)\s*$/) ?
> > className.replace(/^\s*(\S+)\s*$/,"$1") : "";
> 
> That seems to work well.

Good, Good.

> > mainly because a DOM binding with optional parameters
> > isn't language independant, and if it's a ECMAScript tied DOM, then
> > the DOM needs to be a lot more ECMAScript like.
> 
> 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.

However there's a good argument for making an ECMAScript specific DOM,
as it would be more natural for the majority of ECMAScript programmers
who use it, but that would mean redefining most of the HTML DOM into
something neat in ES eyes.

Jim.



More information about the whatwg mailing list