rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/;
-function raf() {
- if ( timerId ) {
- window.requestAnimationFrame( raf );
- jQuery.fx.tick();
- }
-}
-
-// Will get false negative for old browsers which is okay
-function isDocumentHidden() {
- return "hidden" in document && document.hidden;
-}
-
// Animations created synchronously will run synchronously
function createFxNow() {
window.setTimeout( function() {
.end().animate( { opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
- if ( isDocumentHidden() ) {
- return this;
- }
-
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
jQuery.fx.start = function() {
if ( !timerId ) {
- if ( window.requestAnimationFrame ) {
- timerId = true;
- window.requestAnimationFrame( raf );
- } else {
- timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
- }
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
return;
}
-var oldRaf = window.requestAnimationFrame;
-
module("effects", {
setup: function() {
- window.requestAnimationFrame = null;
this.clock = sinon.useFakeTimers( 505877050 );
this._oldInterval = jQuery.fx.interval;
jQuery.fx.interval = 10;
this.clock.restore();
jQuery.fx.stop();
jQuery.fx.interval = this._oldInterval;
- window.requestAnimationFrame = oldRaf;
return moduleTeardown.apply( this, arguments );
}
});