From 3a7c1bc07a025cb538d2f8b77fb32362a18ee1f0 Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 10 Jul 2012 09:00:26 -0400 Subject: Effects: Work around jQuery 1.6.2 returning undefined for falsy values in .data(). --- ui/jquery.ui.effect.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js index 93e85ebfd..7cabe5849 100644 --- a/ui/jquery.ui.effect.js +++ b/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 ); } } }, -- cgit v1.2.3