diff options
-rw-r--r-- | tests/unit/effects/effects.html | 3 | ||||
-rw-r--r-- | tests/unit/effects/effects_core.js | 13 | ||||
-rw-r--r-- | ui/jquery.effects.core.js | 2 | ||||
-rw-r--r-- | ui/jquery.effects.scale.js | 20 | ||||
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 35 |
5 files changed, 48 insertions, 25 deletions
diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html index 0879a98b2..84fecd9cc 100644 --- a/tests/unit/effects/effects.html +++ b/tests/unit/effects/effects.html @@ -38,10 +38,13 @@ .test { background: #000; border: 0; + width: 100px; + height: 100px; } .testAddBorder { border: 10px solid #000; } + .testChildren, .testChangeBackground { background: #fff; } diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js index 8d2e8f8df..ed9fbf9ba 100644 --- a/tests/unit/effects/effects_core.js +++ b/tests/unit/effects/effects_core.js @@ -77,12 +77,12 @@ asyncTest( "animateClass works with colors", function() { count = 0; expect(2); test.toggleClass("testChangeBackground", duration, function() { - present( test.css("backgroundColor"), [ "#ffffff", "rgb(255, 255, 255)" ], "Color is final" ); + present( test.css("backgroundColor"), [ "#ffffff", "#fff", "rgb(255, 255, 255)" ], "Color is final" ); start(); }); setTimeout(function() { var color = test.css("backgroundColor"); - notPresent( color, [ "#000000", "#ffffff", "rgb(0, 0, 0)", "rgb(255,255,255)" ], + notPresent( color, [ "#000000", "#ffffff", "#000", "#fff", "rgb(0, 0, 0)", "rgb(255,255,255)" ], "Color is not endpoints in middle." ); }, mid); }); @@ -92,19 +92,20 @@ asyncTest( "animateClass works with children", function() { h2 = test.find("h2"); expect(4); + setTimeout(function() { + notPresent( h2.css("fontSize"), ["10px","20px"], "Font size is neither endpoint when in middle."); + }, mid); test.toggleClass("testChildren", { children: true, duration: duration, complete: function() { equal( h2.css("fontSize"), "20px", "Text size is final during complete"); test.toggleClass("testChildren", duration, function() { equal( h2.css("fontSize"), "10px", "Text size revertted after class removed"); + start(); }); setTimeout(function() { - equal( h2.css("fontSize"), "20px", "Text size unchanged with children: undefined" ); + equal( h2.css("fontSize"), "20px", "Text size unchanged during animate with children: undefined" ); }, mid); }}); - setTimeout(function() { - notPresent( h2.css("fontSize"), ["10px","20px"], "Font size is neither endpoint when in middle."); - }, mid); }); })(jQuery); diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 638119579..7650aa8f4 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -451,7 +451,7 @@ $.extend( $.effects, { setTransition: function( element, list, factor, value ) { value = value || {}; $.each( list, function(i, x){ - unit = element.cssUnit( x ); + var unit = element.cssUnit( x ); if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; }); return value; diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index 843aa2241..b5c49ce7c 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -115,11 +115,15 @@ $.effects.effect.size = function( o ) { restore = o.restore || false, scale = o.scale || 'both', origin = o.origin, - original = { - height: el.height(), - width: el.width() - }, - baseline, factor; + original, baseline, factor; + + if ( mode === "show" ) { + el.show(); + } + original = { + height: el.height(), + width: el.width() + }; el.from = o.from || original; el.to = o.to || original; @@ -149,14 +153,14 @@ $.effects.effect.size = function( o ) { if ( scale == 'box' || scale == 'both' ) { // Vertical props scaling - if ( factor.from.y != factor.to.y ) { + if ( factor.from.y !== factor.to.y ) { props = props.concat( vProps ); el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); }; // Horizontal props scaling - if ( factor.from.x != factor.to.x ) { + if ( factor.from.x !== factor.to.x ) { props = props.concat( hProps ); el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); @@ -167,7 +171,7 @@ $.effects.effect.size = function( o ) { if ( scale == 'content' || scale == 'both' ) { // Vertical props scaling - if ( factor.from.y != factor.to.y ) { + if ( factor.from.y !== factor.to.y ) { props = props.concat( cProps ); el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 0e62ccfdb..f6573174a 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -47,7 +47,8 @@ $.widget( "ui.autocomplete", { _create: function() { var self = this, doc = this.element[ 0 ].ownerDocument, - suppressKeyPress; + suppressKeyPress, + suppressInput; this.valueMethod = this.element[ this.element.is( "input" ) ? "val" : "text" ]; @@ -63,10 +64,12 @@ $.widget( "ui.autocomplete", { .bind( "keydown.autocomplete", function( event ) { if ( self.options.disabled || self.element.attr( "readonly" ) ) { suppressKeyPress = true; + suppressInput = true; return; } suppressKeyPress = false; + suppressInput = false; var keyCode = $.ui.keyCode; switch( event.keyCode ) { case keyCode.PAGE_UP: @@ -110,15 +113,8 @@ $.widget( "ui.autocomplete", { self.close( event ); break; default: - // keypress is triggered before the input value is changed - clearTimeout( self.searching ); - self.searching = setTimeout(function() { - // only search if the value has changed - if ( self.term != self._value() ) { - self.selectedItem = null; - self.search( null, event ); - } - }, self.options.delay ); + // search timeout should be triggered before the input value is changed + self._searchTimeout( event ); break; } }) @@ -150,6 +146,14 @@ $.widget( "ui.autocomplete", { break; } }) + .bind( "input.autocomplete", function(event) { + if ( suppressInput ) { + suppressInput = false; + event.preventDefault(); + return; + } + self._searchTimeout( event ); + }) .bind( "focus.autocomplete", function() { if ( self.options.disabled ) { return; @@ -317,6 +321,17 @@ $.widget( "ui.autocomplete", { } }, + _searchTimeout: function( event ) { + var self = this; + self.searching = setTimeout(function() { + // only search if the value has changed + if ( self.term != self.element.val() ) { + self.selectedItem = null; + self.search( null, event ); + } + }, self.options.delay ); + }, + search: function( value, event ) { value = value != null ? value : this._value(); |