- From: Martin Atkins <mart@degeneration.co.uk>
- Date: Tue, 01 May 2007 08:05:49 +0100
Maciej Stachowiak wrote: > > > How about about adding a toggle() operation to classList? Adds the token > if not present, removes it if present. This would be useful for script > code that dynamically manipulates classes to cause style changes. > It's been my experience that toggles are troublesome. In order for a call to toggle() to be successful -- where by successful I mean that it makes the change you intended -- you need to know the state ahead of time. If you have two distinct scripts "toggling" the same value, they're going to get out of step and think they're turning on when they're turning off. Or did you have a use-case in mind where it doesn't matter what the end result is as long as it's not what it was before?
Received on Tuesday, 1 May 2007 00:05:49 UTC