xuijs / xui

A tiny javascript framework for mobile web apps.

Home Page:http://xuijs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shoult it have toggleClass?

AlexNolasco opened this issue · comments

Should XUI have toggleClass for convenience sake?

/* perhaps something like this */

    function  toggleClass (className){
        var self = this;
        if (className !== undefined) {                
            this.each(function(el) {
                if(hasClass(el, className)){
                    x$(el).removeClass(className);                    
                } else {
                    x$(el).addClass(className);
                }
            });
        }
        return this;
    }

gets my vote.

added in 0307780