git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Brought back the compareDocumentPosition code. While it is redundant in Firefox it...
[jquery.git]
/
src
/
fx.js
diff --git
a/src/fx.js
b/src/fx.js
index
40bbc61
..
c949bdc
100644
(file)
--- a/
src/fx.js
+++ b/
src/fx.js
@@
-1,4
+1,5
@@
var elemdisplay = {},
var elemdisplay = {},
+ timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
@@
-43,9
+44,15
@@
jQuery.fn.extend({
elemdisplay[ tagName ] = display;
}
elemdisplay[ tagName ] = display;
}
- this[i].style.display = jQuery.data(this[i], "olddisplay", display);
+ jQuery.data(this[i], "olddisplay", display);
}
}
}
}
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
+ this[i].style.display = jQuery.data(this[i], "olddisplay") || "";
+ }
return this;
}
return this;
}
@@
-59,8
+66,14
@@
jQuery.fn.extend({
var old = jQuery.data(this[i], "olddisplay");
if ( !old && old !== "none" )
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
var old = jQuery.data(this[i], "olddisplay");
if ( !old && old !== "none" )
jQuery.data(this[i], "olddisplay", jQuery.css(this[i], "display"));
+ }
+
+ // Set the display of the elements in a second loop
+ // to avoid the constant reflow
+ for ( var i = 0, l = this.length; i < l; i++ ){
this[i].style.display = "none";
}
this[i].style.display = "none";
}
+
return this;
}
},
return this;
}
},
@@
-221,7
+234,6
@@
jQuery.extend({
},
timers: [],
},
timers: [],
- timerId: null,
fx: function( elem, options, prop ){
this.options = options;
fx: function( elem, options, prop ){
this.options = options;
@@
-273,10
+285,8
@@
jQuery.fx.prototype = {
t.elem = this.elem;
t.elem = this.elem;
- jQuery.timers.push(t);
-
- if ( t() && jQuery.timerId == null ) {
- jQuery.timerId = setInterval(function(){
+ if ( t() && jQuery.timers.push(t) && !timerId ) {
+ timerId = setInterval(function(){
var timers = jQuery.timers;
for ( var i = 0; i < timers.length; i++ )
var timers = jQuery.timers;
for ( var i = 0; i < timers.length; i++ )
@@
-284,8
+294,8
@@
jQuery.fx.prototype = {
timers.splice(i--, 1);
if ( !timers.length ) {
timers.splice(i--, 1);
if ( !timers.length ) {
- clearInterval( jQuery.timerId );
- jQuery.timerId = null;
+ clearInterval( timerId );
+ timerId = undefined;
}
}, 13);
}
}
}, 13);
}
@@
-351,11
+361,10
@@
jQuery.fx.prototype = {
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
- }
-
- if ( done )
+
// Execute the complete function
this.options.complete.call( this.elem );
// Execute the complete function
this.options.complete.call( this.elem );
+ }
return false;
} else {
return false;
} else {