@@ -306,6 +306,16 @@ var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animate
306
306
return $animate ;
307
307
308
308
function queueAnimation ( originalElement , event , initialOptions ) {
309
+ // we create a fake runner with a working promise.
310
+ // These methods will become available after the digest has passed
311
+ var runner = new $$AnimateRunner ( ) ;
312
+
313
+ // If animations are hard-disabled for the whole application there is no need to continue
314
+ if ( ! animationsEnabled ) {
315
+ close ( ) ;
316
+ return runner ;
317
+ }
318
+
309
319
// we always make a copy of the options since
310
320
// there should never be any side effects on
311
321
// the input data when running `$animateCss`.
@@ -317,10 +327,6 @@ var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animate
317
327
318
328
options = prepareAnimationOptions ( options ) ;
319
329
320
- // we create a fake runner with a working promise.
321
- // These methods will become available after the digest has passed
322
- var runner = new $$AnimateRunner ( ) ;
323
-
324
330
// this is used to trigger callbacks in postDigest mode
325
331
var runInNextPostDigestOrNow = postDigestTaskFactory ( ) ;
326
332
@@ -348,7 +354,7 @@ var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animate
348
354
options . to = null ;
349
355
}
350
356
351
- // there are situations where a directive issues an animation for
357
+ // There are situations where a directive issues an animation for
352
358
// a jqLite wrapper that contains only comment nodes... If this
353
359
// happens then there is no way we can perform an animation
354
360
if ( ! node ||
@@ -362,12 +368,11 @@ var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animate
362
368
363
369
var documentHidden = $$isDocumentHidden ( ) ;
364
370
365
- // this is a hard disable of all animations for the application or on
366
- // the element itself, therefore there is no need to continue further
367
- // past this point if not enabled
371
+ // This is a hard disable of all animations the element itself, therefore there is no need to
372
+ // continue further past this point if not enabled
368
373
// Animations are also disabled if the document is currently hidden (page is not visible
369
374
// to the user), because browsers slow down or do not flush calls to requestAnimationFrame
370
- var skipAnimations = ! animationsEnabled || documentHidden || disabledElementsLookup . get ( node ) ;
375
+ var skipAnimations = documentHidden || disabledElementsLookup . get ( node ) ;
371
376
var existingAnimation = ( ! skipAnimations && activeAnimationsLookup . get ( node ) ) || { } ;
372
377
var hasExistingAnimation = ! ! existingAnimation . state ;
373
378
0 commit comments