Skip to content
Permalink
Browse files

Effects: Work around jQuery 1.6.2 returning undefined for falsy value…

…s in .data().
  • Loading branch information
scottgonzalez committed Jul 10, 2012
1 parent 2ed34e4 commit 3a7c1bc07a025cb538d2f8b77fb32362a18ee1f0
Showing with 12 additions and 2 deletions.
  1. +12 −2 ui/jquery.ui.effect.js
@@ -861,9 +861,19 @@ $.extend( $.effects, {

// Restores a set of previously saved properties from a data storage
restore: function( element, set ) {
for( var i=0; i < set.length; i++ ) {
var val, i;
for( i=0; i < set.length; i++ ) {
if ( set[ i ] !== null ) {
element.css( set[ i ], element.data( dataSpace + set[ i ] ) );
val = element.data( dataSpace + set[ i ] );
// support: jQuery 1.6.2
// http://bugs.jquery.com/ticket/9917
// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
// We can't differentiate between "" and 0 here, so we just assume
// empty string since it's likely to be a more common value...
if ( val === undefined ) {
val = "";
}
element.css( set[ i ], val );
}
}
},

0 comments on commit 3a7c1bc

Please sign in to comment.
You can’t perform that action at this time.