@@ -12,6 +12,10 @@ function mergeClasses(a,b) {
12
12
return a + ' ' + b ;
13
13
}
14
14
15
+ function makeAnimateOptions ( options ) {
16
+ return isObject ( options ) ? options : { } ;
17
+ }
18
+
15
19
function extractElementNode ( element ) {
16
20
for ( var i = 0 ; i < element . length ; i ++ ) {
17
21
var elm = element [ i ] ;
@@ -406,6 +410,7 @@ var $AnimateProvider = ['$provide', function($provide) {
406
410
* @return {Promise } the animation callback promise
407
411
*/
408
412
enter : function ( element , parent , after , options ) {
413
+ options = makeAnimateOptions ( options ) ;
409
414
parent = parent || after . parent ( ) ;
410
415
domInsert ( element , parent , after ) ;
411
416
return $$animateQueue . push ( element , 'enter' , options ) ;
@@ -430,6 +435,7 @@ var $AnimateProvider = ['$provide', function($provide) {
430
435
* @return {Promise } the animation callback promise
431
436
*/
432
437
move : function ( element , parent , after , options ) {
438
+ options = makeAnimateOptions ( options ) ;
433
439
parent = parent || after . parent ( ) ;
434
440
domInsert ( element , parent , after ) ;
435
441
return $$animateQueue . push ( element , 'move' , options ) ;
@@ -449,6 +455,7 @@ var $AnimateProvider = ['$provide', function($provide) {
449
455
* @return {Promise } the animation callback promise
450
456
*/
451
457
leave : function ( element , options ) {
458
+ options = makeAnimateOptions ( options ) ;
452
459
return $$animateQueue . push ( element , 'leave' , options , function ( ) {
453
460
element . remove ( ) ;
454
461
} ) ;
@@ -473,7 +480,7 @@ var $AnimateProvider = ['$provide', function($provide) {
473
480
* @return {Promise } the animation callback promise
474
481
*/
475
482
addClass : function ( element , className , options ) {
476
- options = options || { } ;
483
+ options = makeAnimateOptions ( options ) ;
477
484
options . addClass = mergeClasses ( options . addclass , className ) ;
478
485
return $$animateQueue . push ( element , 'addClass' , options ) ;
479
486
} ,
@@ -497,7 +504,7 @@ var $AnimateProvider = ['$provide', function($provide) {
497
504
* @return {Promise } the animation callback promise
498
505
*/
499
506
removeClass : function ( element , className , options ) {
500
- options = options || { } ;
507
+ options = makeAnimateOptions ( options ) ;
501
508
options . removeClass = mergeClasses ( options . removeClass , className ) ;
502
509
return $$animateQueue . push ( element , 'removeClass' , options ) ;
503
510
} ,
@@ -522,7 +529,7 @@ var $AnimateProvider = ['$provide', function($provide) {
522
529
* @return {Promise } the animation callback promise
523
530
*/
524
531
setClass : function ( element , add , remove , options ) {
525
- options = options || { } ;
532
+ options = makeAnimateOptions ( options ) ;
526
533
options . addClass = mergeClasses ( options . addClass , add ) ;
527
534
options . removeClass = mergeClasses ( options . removeClass , remove ) ;
528
535
return $$animateQueue . push ( element , 'setClass' , options ) ;
@@ -550,7 +557,7 @@ var $AnimateProvider = ['$provide', function($provide) {
550
557
* @return {Promise } the animation callback promise
551
558
*/
552
559
animate : function ( element , from , to , className , options ) {
553
- options = options || { } ;
560
+ options = makeAnimateOptions ( options ) ;
554
561
options . from = options . from ? extend ( options . from , from ) : from ;
555
562
options . to = options . to ? extend ( options . to , to ) : to ;
556
563
0 commit comments