]> source.dussan.org Git - jquery.git/commitdiff
Fixed a loop that only worked in webkit.
authorjaubourg <aubourg.julian@gmail.com>
Mon, 20 Dec 2010 23:56:00 +0000 (00:56 +0100)
committerunknown <Julian@.(none)>
Fri, 24 Dec 2010 11:55:47 +0000 (12:55 +0100)
src/core.js

index f7713ca8215dd101e6021f8198a668833eb9be35..39d49743c0c9436c35834c730c70c39487ed3db1 100644 (file)
@@ -800,12 +800,14 @@ jQuery.extend({
                        deferred  = {
                                
                                // then( f1, f2, ...)
-                               then: function() {
+                               then: function then() {
                                        
                                        if ( ! cancelled ) {
                                        
                                                var args = arguments,
                                                        i,
+                                                       length,
+                                                       elem,
                                                        type,
                                                        _fired;
                                                        
@@ -814,13 +816,13 @@ jQuery.extend({
                                                        fired = 0;
                                                }
                                                
-                                               for ( i in args ) {
-                                                       i = args[ i ];
-                                                       type = jQuery.type( i );
+                                               for ( i = 0, length = args.length ; i < length ; i++ ) {
+                                                       elem = args[ i ];
+                                                       type = jQuery.type( elem );
                                                        if ( type === "array" ) {
-                                                               this.then.apply( this , i );
+                                                               then.apply( this , elem );
                                                        } else if ( type === "function" ) {
-                                                               callbacks.push( i );
+                                                               callbacks.push( elem );
                                                        }
                                                }