Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Element.swapClass breaking on empty arguments #1157

carlholmberg opened this Issue Oct 17, 2012 · 1 comment


None yet
2 participants

Using the Bootstrap port from Aaron Newton the swapClass method sometimes gets sent empty values for 'from' and/or 'to'. One way to fix this is to make swapClass more robust i.e.

    swapClass: function(remove, add){
        if (remove && add)
            return this.removeClass(remove).addClass(add);
        else if (remove)
            return this.removeClass(remove);


arian commented Oct 17, 2012

I think the check should not be in this method, but in the code that uses this method instead. swapClass works as expected if you use it correctly, otherwise the code that calls it is probably wrong.

@arian arian closed this Oct 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment