Interesting. I like the first one especially. Could you file a bug on these? I'd definitely like to look into them later, but probably not in time for 1.3.
--John On Sun, Jan 11, 2009 at 3:42 AM, Cloudream <[email protected]> wrote: > > 1. remove/re-add all original CSS class > > implement: save original class to $.data on elements > > Case: > el: <span class="a b" /> > > step#1:$(el).toggleClass(); > -save "a b" to $.data(this,"originalClass"), then remove "a b" class > on this element. > step#2:$(el).toggleClass(); > -restore $.data(this,"originalClass")(if exists) to this element. > > And with boolean: > step#1:$(el).toggleClass(false); > -save "a b" to $.data(this,"originalClass"), then remove "a b" class > on this element. > > step#1:$(el).toggleClass(true); > -restore $.data(this,"originalClass")(if exists) to this element. > > > 2.handle multi-class without boolean. > use .toggleClass("c b") instead of .toggleClass("c").toggleClass("b") > > implement: split className string before pass it to $.className[add/ > remove], and handle each one separately > > Case: > el: <span class="a b" /> > > step#1:$(el).toggleClass("b c"); > -remove class "b" and add class "c" on this element. > step#2:$(el).toggleClass("b c"); > -remove class "c" and add class "b" on this element. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
