Commit 15e34d1f authored by louisremi's avatar louisremi Committed by timmywil

reduce impact of requestAnimationFrame on incompatible browsers by minimizing number of lookups

parent 03e6f723
...@@ -363,9 +363,17 @@ jQuery.fx.prototype = { ...@@ -363,9 +363,17 @@ jQuery.fx.prototype = {
t.elem = this.elem; t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) { if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = jQuery.support.requestAnimationFrame ? if ( jQuery.support.requestAnimationFrame ) {
!window[jQuery.support.requestAnimationFrame](fx.tick): timerId = true;
setInterval(fx.tick, fx.interval); (function raf() {
if (timerId) {
window[jQuery.support.requestAnimationFrame](raf);
}
fx.tick();
})();
} else {
timerId = setInterval(fx.tick, fx.interval);
}
} }
}, },
...@@ -470,8 +478,6 @@ jQuery.extend( jQuery.fx, { ...@@ -470,8 +478,6 @@ jQuery.extend( jQuery.fx, {
if ( !timers.length ) { if ( !timers.length ) {
jQuery.fx.stop(); jQuery.fx.stop();
} else if ( jQuery.support.requestAnimationFrame && timerId) {
window[jQuery.support.requestAnimationFrame](jQuery.fx.tick);
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment