- From: Maciej Stachowiak <mjs@apple.com>
- Date: Thu, 1 Mar 2007 21:26:41 -0800
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
Received on Thursday, 1 March 2007 21:26:41 UTC