diff options
author | Brandon Aaron <brandon.aaron@gmail.com> | 2009-05-02 22:35:39 +0000 |
---|---|---|
committer | Brandon Aaron <brandon.aaron@gmail.com> | 2009-05-02 22:35:39 +0000 |
commit | e45b41602ff483ebed67b5b73008aff5ceb1fe6f (patch) | |
tree | 2d26e9d6fa7fd40a216c42fff41307db23818f81 /src | |
parent | 5e6e53835e552920db4f88ac0c9eca71aaacbef0 (diff) | |
download | jquery-e45b41602ff483ebed67b5b73008aff5ceb1fe6f.tar.gz jquery-e45b41602ff483ebed67b5b73008aff5ceb1fe6f.zip |
make sure toggleClass does not delete classNames when forcefully removing classes and they are already removed
Diffstat (limited to 'src')
-rw-r--r-- | src/attributes.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/attributes.js b/src/attributes.js index 04562ff8b..f3e1b4cb3 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -141,13 +141,12 @@ jQuery.each({ jQuery.className[ state ? "add" : "remove" ]( this, className ); } } else if ( type === "undefined" || type === "boolean" ) { - // toggle whole className - if ( this.className || classNames === false ) { + if ( this.className ) { + // store className if set jQuery.data( this, "__className__", this.className ); - this.className = ""; - } else { - this.className = jQuery.data( this, "__className__" ) || ""; } + // toggle whole className + this.className = this.className || classNames === false ? "" : jQuery.data( this, "__className__" ) || ""; } } }, function(name, fn){ |