[whatwg] getElementsByClassName()

On 2/4/06, Brad Fults <bfults at gmail.com> wrote:
> I can't believe that you're so insistent upon this extremely narrow
> set of use cases and that there aren't any other popular use cases for
> getElementsByClassName().

It's the only one that's ever been voiced without the extreme
prompting now generating some.    The WHAT specifications (like the W3
specifications, indeed most specifications) are creating features, and
never voicing why they're necessary, the use cases are simply not made
- there probably are use cases for them, but they _must_ be voiced,
otherwise you simply cannot review them.

> The requirement for a loaded document is to be expected when one
> wishes to manipulate the constructed DOM from that document.

No such requirement exists in web-browsers today, why are you suddenly
inventing it?

> I want my designer to be able to specify an arbitrary set of elements
> in the markup for a web app that are to be "widgets". Now if the web
> app is sent out to a client that supports function X, I want to
> construct this X-widget around each of the elements in the set
> previously defined.

This use case is fulfilled by the -moz-binding and similar proposals,
it does this more successfully (as it does not lead to the
inconsistent UI problem)  I don't see the point in having both
className selectors and -moz-binding XBL approaches, but thanks for
the details.

> Now that we can get past "why" we're specifying such a function, I
> feel the need to reiterate the constraints on its specification,

but we can't know the constraints until we know why we're specifying it...

> 2. getElementsByClassName() must be *binding language* agnostic. That
> is, we cannot assume that it will only be used in JS.

I don't agree that it's necessary to do this, one of the historic
problems of the DOM in the ECMAScript context (and others) is that
individual language strenghts are not gained.  There is nothing
obviously wrong with having language specific API's.

> If getElementsByClassName() receives an array (synonymous with list),
> which all binding languages I am aware of are capable of supplying,

Do some binding languages not require the type of the parameter to be
specified as either an array or a string?

I do not personally see the use case for a class specific operator,
either a CSS Selector method, that selects on any CSS selector, or
nothing seems appropriate.

Cheers,

Jim.

Received on Saturday, 4 February 2006 03:11:52 UTC