Skip to content
Permalink
Browse files

reduce impact of requestAnimationFrame on incompatible browsers by mi…

…nimizing number of lookups
  • Loading branch information
louisremi timmywil
louisremi authored and timmywil committed Feb 2, 2011
1 parent 03e6f72 commit 15e34d1f07d0c687d040af22dbc66f3978715217
Showing with 11 additions and 5 deletions.
  1. +11 −5 src/effects.js
@@ -363,9 +363,17 @@ jQuery.fx.prototype = {
t.elem = this.elem;

if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = jQuery.support.requestAnimationFrame ?
!window[jQuery.support.requestAnimationFrame](fx.tick):
setInterval(fx.tick, fx.interval);
if ( jQuery.support.requestAnimationFrame ) {
timerId = true;
(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, {

if ( !timers.length ) {
jQuery.fx.stop();
} else if ( jQuery.support.requestAnimationFrame && timerId) {
window[jQuery.support.requestAnimationFrame](jQuery.fx.tick);
}
},

0 comments on commit 15e34d1

Please sign in to comment.
You can’t perform that action at this time.