Skip to content

Commit 3a7c1bc

Browse files
committed
Effects: Work around jQuery 1.6.2 returning undefined for falsy values in .data().
1 parent 2ed34e4 commit 3a7c1bc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ui/jquery.ui.effect.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,19 @@ $.extend( $.effects, {
861861

862862
// Restores a set of previously saved properties from a data storage
863863
restore: function( element, set ) {
864-
for( var i=0; i < set.length; i++ ) {
864+
var val, i;
865+
for( i=0; i < set.length; i++ ) {
865866
if ( set[ i ] !== null ) {
866-
element.css( set[ i ], element.data( dataSpace + set[ i ] ) );
867+
val = element.data( dataSpace + set[ i ] );
868+
// support: jQuery 1.6.2
869+
// http://bugs.jquery.com/ticket/9917
870+
// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
871+
// We can't differentiate between "" and 0 here, so we just assume
872+
// empty string since it's likely to be a more common value...
873+
if ( val === undefined ) {
874+
val = "";
875+
}
876+
element.css( set[ i ], val );
867877
}
868878
}
869879
},

0 commit comments

Comments
 (0)