22 DateWrapper ,
33 StringWrapper ,
44 RegExpWrapper ,
5- NumberWrapper
5+ NumberWrapper ,
6+ isPresent
67} from 'angular2/src/core/facade/lang' ;
78import { Math } from 'angular2/src/core/facade/math' ;
89import { camelCaseToDashCase } from 'angular2/src/core/render/dom/util' ;
@@ -31,6 +32,8 @@ export class Animation {
3132 /** flag used to track whether or not the animation has finished */
3233 completed : boolean = false ;
3334
35+ private _stringPrefix : string = '' ;
36+
3437 /** total amount of time that the animation should take including delay */
3538 get totalTime ( ) : number {
3639 let delay = this . computedDelay != null ? this . computedDelay : 0 ;
@@ -47,6 +50,7 @@ export class Animation {
4750 constructor ( public element : HTMLElement , public data : CssAnimationOptions ,
4851 public browserDetails : BrowserDetails ) {
4952 this . startTime = DateWrapper . toMillis ( DateWrapper . now ( ) ) ;
53+ this . _stringPrefix = DOM . getAnimationPrefix ( ) ;
5054 this . setup ( ) ;
5155 this . wait ( timestamp => this . start ( ) ) ;
5256 }
@@ -77,11 +81,14 @@ export class Animation {
7781 if ( this . data . toStyles != null ) this . applyStyles ( this . data . toStyles ) ;
7882 var computedStyles = DOM . getComputedStyle ( this . element ) ;
7983 this . computedDelay =
80- Math . max ( this . parseDurationString ( computedStyles . getPropertyValue ( 'transition-delay' ) ) ,
81- this . parseDurationString ( this . element . style . getPropertyValue ( 'transition-delay' ) ) ) ;
82- this . computedDuration = Math . max (
83- this . parseDurationString ( computedStyles . getPropertyValue ( 'transition-duration' ) ) ,
84- this . parseDurationString ( this . element . style . getPropertyValue ( 'transition-duration' ) ) ) ;
84+ Math . max ( this . parseDurationString (
85+ computedStyles . getPropertyValue ( this . _stringPrefix + 'transition-delay' ) ) ,
86+ this . parseDurationString (
87+ this . element . style . getPropertyValue ( this . _stringPrefix + 'transition-delay' ) ) ) ;
88+ this . computedDuration = Math . max ( this . parseDurationString ( computedStyles . getPropertyValue (
89+ this . _stringPrefix + 'transition-duration' ) ) ,
90+ this . parseDurationString ( this . element . style . getPropertyValue (
91+ this . _stringPrefix + 'transition-duration' ) ) ) ;
8592 this . addEvents ( ) ;
8693 }
8794
@@ -91,7 +98,12 @@ export class Animation {
9198 */
9299 applyStyles ( styles : StringMap < string , any > ) : void {
93100 StringMapWrapper . forEach ( styles , ( value , key ) => {
94- DOM . setStyle ( this . element , camelCaseToDashCase ( key ) , value . toString ( ) ) ;
101+ var dashCaseKey = camelCaseToDashCase ( key ) ;
102+ if ( isPresent ( DOM . getStyle ( this . element , dashCaseKey ) ) ) {
103+ DOM . setStyle ( this . element , dashCaseKey , value . toString ( ) ) ;
104+ } else {
105+ DOM . setStyle ( this . element , this . _stringPrefix + dashCaseKey , value . toString ( ) ) ;
106+ }
95107 } ) ;
96108 }
97109
@@ -117,7 +129,7 @@ export class Animation {
117129 addEvents ( ) : void {
118130 if ( this . totalTime > 0 ) {
119131 this . eventClearFunctions . push ( DOM . onAndCancel (
120- this . element , 'transitionend' , ( event : any ) => this . handleAnimationEvent ( event ) ) ) ;
132+ this . element , DOM . getTransitionEnd ( ) , ( event : any ) => this . handleAnimationEvent ( event ) ) ) ;
121133 } else {
122134 this . handleAnimationCompleted ( ) ;
123135 }
0 commit comments