@@ -12,6 +12,10 @@ function mergeClasses(a,b) {
1212 return a + ' ' + b ;
1313}
1414
15+ function makeAnimateOptions ( options ) {
16+ return isObject ( options ) ? options : { } ;
17+ }
18+
1519function extractElementNode ( element ) {
1620 for ( var i = 0 ; i < element . length ; i ++ ) {
1721 var elm = element [ i ] ;
@@ -406,6 +410,7 @@ var $AnimateProvider = ['$provide', function($provide) {
406410 * @return {Promise } the animation callback promise
407411 */
408412 enter : function ( element , parent , after , options ) {
413+ options = makeAnimateOptions ( options ) ;
409414 parent = parent || after . parent ( ) ;
410415 domInsert ( element , parent , after ) ;
411416 return $$animateQueue . push ( element , 'enter' , options ) ;
@@ -430,6 +435,7 @@ var $AnimateProvider = ['$provide', function($provide) {
430435 * @return {Promise } the animation callback promise
431436 */
432437 move : function ( element , parent , after , options ) {
438+ options = makeAnimateOptions ( options ) ;
433439 parent = parent || after . parent ( ) ;
434440 domInsert ( element , parent , after ) ;
435441 return $$animateQueue . push ( element , 'move' , options ) ;
@@ -449,6 +455,7 @@ var $AnimateProvider = ['$provide', function($provide) {
449455 * @return {Promise } the animation callback promise
450456 */
451457 leave : function ( element , options ) {
458+ options = makeAnimateOptions ( options ) ;
452459 return $$animateQueue . push ( element , 'leave' , options , function ( ) {
453460 element . remove ( ) ;
454461 } ) ;
@@ -473,7 +480,7 @@ var $AnimateProvider = ['$provide', function($provide) {
473480 * @return {Promise } the animation callback promise
474481 */
475482 addClass : function ( element , className , options ) {
476- options = options || { } ;
483+ options = makeAnimateOptions ( options ) ;
477484 options . addClass = mergeClasses ( options . addclass , className ) ;
478485 return $$animateQueue . push ( element , 'addClass' , options ) ;
479486 } ,
@@ -497,7 +504,7 @@ var $AnimateProvider = ['$provide', function($provide) {
497504 * @return {Promise } the animation callback promise
498505 */
499506 removeClass : function ( element , className , options ) {
500- options = options || { } ;
507+ options = makeAnimateOptions ( options ) ;
501508 options . removeClass = mergeClasses ( options . removeClass , className ) ;
502509 return $$animateQueue . push ( element , 'removeClass' , options ) ;
503510 } ,
@@ -522,7 +529,7 @@ var $AnimateProvider = ['$provide', function($provide) {
522529 * @return {Promise } the animation callback promise
523530 */
524531 setClass : function ( element , add , remove , options ) {
525- options = options || { } ;
532+ options = makeAnimateOptions ( options ) ;
526533 options . addClass = mergeClasses ( options . addClass , add ) ;
527534 options . removeClass = mergeClasses ( options . removeClass , remove ) ;
528535 return $$animateQueue . push ( element , 'setClass' , options ) ;
@@ -550,7 +557,7 @@ var $AnimateProvider = ['$provide', function($provide) {
550557 * @return {Promise } the animation callback promise
551558 */
552559 animate : function ( element , from , to , className , options ) {
553- options = options || { } ;
560+ options = makeAnimateOptions ( options ) ;
554561 options . from = options . from ? extend ( options . from , from ) : from ;
555562 options . to = options . to ? extend ( options . to , to ) : to ;
556563
0 commit comments