[whatwg] Problems with DOMTokenString
Maciej Stachowiak
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.
>
> Fixed.
Thanks!
>> 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
> than
> 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
I could imagine it being useful for JavaScript/AJAX libraries given
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.
Regards,
Maciej
More information about the whatwg
mailing list