@@ -40,6 +40,12 @@ function splitClasses(classes) {
40
40
return obj ;
41
41
}
42
42
43
+ function prepareAnimateOptions ( options ) {
44
+ return isObject ( options )
45
+ ? options
46
+ : { } ;
47
+ }
48
+
43
49
var $$CoreAnimateRunnerProvider = function ( ) {
44
50
this . $get = [ '$q' , '$$rAF' , function ( $q , $$rAF ) {
45
51
function AnimateRunner ( ) { }
@@ -420,7 +426,7 @@ var $AnimateProvider = ['$provide', function($provide) {
420
426
after = after && jqLite ( after ) ;
421
427
parent = parent || after . parent ( ) ;
422
428
domInsert ( element , parent , after ) ;
423
- return $$animateQueue . push ( element , 'enter' , options ) ;
429
+ return $$animateQueue . push ( element , 'enter' , prepareAnimateOptions ( options ) ) ;
424
430
} ,
425
431
426
432
/**
@@ -446,7 +452,7 @@ var $AnimateProvider = ['$provide', function($provide) {
446
452
after = after && jqLite ( after ) ;
447
453
parent = parent || after . parent ( ) ;
448
454
domInsert ( element , parent , after ) ;
449
- return $$animateQueue . push ( element , 'move' , options ) ;
455
+ return $$animateQueue . push ( element , 'move' , prepareAnimateOptions ( options ) ) ;
450
456
} ,
451
457
452
458
/**
@@ -463,7 +469,7 @@ var $AnimateProvider = ['$provide', function($provide) {
463
469
* @return {Promise } the animation callback promise
464
470
*/
465
471
leave : function ( element , options ) {
466
- return $$animateQueue . push ( element , 'leave' , options , function ( ) {
472
+ return $$animateQueue . push ( element , 'leave' , prepareAnimateOptions ( options ) , function ( ) {
467
473
element . remove ( ) ;
468
474
} ) ;
469
475
} ,
@@ -487,7 +493,7 @@ var $AnimateProvider = ['$provide', function($provide) {
487
493
* @return {Promise } the animation callback promise
488
494
*/
489
495
addClass : function ( element , className , options ) {
490
- options = options || { } ;
496
+ options = prepareAnimateOptions ( options ) ;
491
497
options . addClass = mergeClasses ( options . addclass , className ) ;
492
498
return $$animateQueue . push ( element , 'addClass' , options ) ;
493
499
} ,
@@ -511,7 +517,7 @@ var $AnimateProvider = ['$provide', function($provide) {
511
517
* @return {Promise } the animation callback promise
512
518
*/
513
519
removeClass : function ( element , className , options ) {
514
- options = options || { } ;
520
+ options = prepareAnimateOptions ( options ) ;
515
521
options . removeClass = mergeClasses ( options . removeClass , className ) ;
516
522
return $$animateQueue . push ( element , 'removeClass' , options ) ;
517
523
} ,
@@ -536,7 +542,7 @@ var $AnimateProvider = ['$provide', function($provide) {
536
542
* @return {Promise } the animation callback promise
537
543
*/
538
544
setClass : function ( element , add , remove , options ) {
539
- options = options || { } ;
545
+ options = prepareAnimateOptions ( options ) ;
540
546
options . addClass = mergeClasses ( options . addClass , add ) ;
541
547
options . removeClass = mergeClasses ( options . removeClass , remove ) ;
542
548
return $$animateQueue . push ( element , 'setClass' , options ) ;
@@ -564,7 +570,7 @@ var $AnimateProvider = ['$provide', function($provide) {
564
570
* @return {Promise } the animation callback promise
565
571
*/
566
572
animate : function ( element , from , to , className , options ) {
567
- options = options || { } ;
573
+ options = prepareAnimateOptions ( options ) ;
568
574
options . from = options . from ? extend ( options . from , from ) : from ;
569
575
options . to = options . to ? extend ( options . to , to ) : to ;
570
576
0 commit comments