[whatwg] Problems with DOMTokenString
mjs at apple.com
Thu Mar 1 21:26:41 PST 2007
On Feb 11, 2007, at 11:41 PM, Ian Hickson wrote:
> On Fri, 2 Feb 2007, Maciej Stachowiak wrote:
>> I looked into DOMTokenString with keen interest, because I believe an
>> API for manipulating individual classes of an HTML element is
>> increasingly important as we see more dynamic sites that use CSS
>> styling. However, I think the design for this is not suitable as-is.
>> Alternative #2: leave the className an ordinary string, but add a new
>> readonly DOMClassList classList property with something like the
>> following interface: [...]
> I've done this. (Calling it DOMTokenList, since it applies to more
> just classes.)
Works for me.
>> If you add DOMString index(unsigned i) and unsigned length, you would
>> also have the ability to enumerate the classes easily, which the
>> API as
>> currently specced lacks.
> Do you think we should add this?
I think it would be useful to have some way to enumerate the current
list of tokens through this API. It seems good for completeness, and
the way they implement compound widgets.
Indexing actually isn't the world's best way to do that from point of
view of efficient implementation, but it's the standard for this sort
of thing in the DOM and class lists are unlikely to have a huge
number of items.
More information about the whatwg