This project is archived and is in readonly mode.

#349 ✓wontfix
Daniel Steigerwald

Small toggleClass enhancement

Reported by Daniel Steigerwald | September 1st, 2008 @ 11:10 PM | in 1.2.3


toggleClass: function(className, force) {
    return ($defined(force) ? force : !this.hasClass(className))
        ? this.addClass(className)
        : this.removeClass(className);
}

Comments and changes to this ticket

  • Tom Occhino

    Tom Occhino October 3rd, 2008 @ 05:56 AM

    • State changed from “new” to “hold”
    • Milestone changed from 2.0 to 1.2.3

    I really like the behavior, but i feel like if we add the force option to toggleClass, we should add it to anywhere else we have a toggle method in the framework... (slide, etc?)

  • Daniel Steigerwald

    Daniel Steigerwald October 6th, 2008 @ 11:26 AM

    Toggle methods are really useful. For example:

    
    
    toggle: function(property, value) {
    	return this.setStyle(property, ({
    		visibility: ['hidden', 'visible'],
    		display: ['none', '']
    	})[property][value ? 1 : 0]);
    }
    
    el.toggle('display', User.isAutenticated());
    
    
  • Christoph Pojer

    Christoph Pojer November 9th, 2010 @ 07:25 PM

    • State changed from “hold” to “wontfix”
    • Milestone order changed from “0” to “0”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Referenced by

Pages