@@ -42,6 +42,7 @@ export class RippleRenderer {
42
42
private _backgroundDiv : HTMLElement ;
43
43
private _rippleElement : HTMLElement ;
44
44
private _triggerElement : HTMLElement ;
45
+ _opacity : string ;
45
46
46
47
constructor ( _elementRef : ElementRef , private _eventHandlers : Map < string , ( e : Event ) => void > ) {
47
48
this . _rippleElement = _elementRef . nativeElement ;
@@ -50,9 +51,7 @@ export class RippleRenderer {
50
51
this . _backgroundDiv = null ;
51
52
}
52
53
53
- /**
54
- * Creates the div for the ripple background, if it doesn't already exist.
55
- */
54
+ /** Creates the div for the ripple background, if it doesn't already exist. */
56
55
createBackgroundIfNeeded ( ) {
57
56
if ( ! this . _backgroundDiv ) {
58
57
this . _backgroundDiv = document . createElement ( 'div' ) ;
@@ -81,16 +80,12 @@ export class RippleRenderer {
81
80
}
82
81
}
83
82
84
- /**
85
- * Installs event handlers on the host element of the md-ripple directive.
86
- */
83
+ /** Installs event handlers on the host element of the md-ripple directive. */
87
84
setTriggerElementToHost ( ) {
88
85
this . setTriggerElement ( this . _rippleElement ) ;
89
86
}
90
87
91
- /**
92
- * Removes event handlers from the current trigger element if needed.
93
- */
88
+ /** Removes event handlers from the current trigger element if needed. */
94
89
clearTriggerElement ( ) {
95
90
this . setTriggerElement ( null ) ;
96
91
}
@@ -137,7 +132,8 @@ export class RippleRenderer {
137
132
rippleDiv . style . transitionDuration = `${ fadeInSeconds } s` ;
138
133
139
134
// https://timtaubert.de/blog/2012/09/css-transitions-for-dynamically-created-dom-elements/
140
- window . getComputedStyle ( rippleDiv ) . opacity ;
135
+ // Store the opacity to prevent this line as being seen as a no-op by optimizers.
136
+ this . _opacity = window . getComputedStyle ( rippleDiv ) . opacity ;
141
137
142
138
rippleDiv . classList . add ( 'md-ripple-fade-in' ) ;
143
139
// Clearing the transform property causes the ripple to animate to its full size.
@@ -149,33 +145,25 @@ export class RippleRenderer {
149
145
( event : TransitionEvent ) => transitionEndCallback ( ripple , event ) ) ;
150
146
}
151
147
152
- /**
153
- * Fades out a foreground ripple after it has fully expanded and faded in.
154
- */
148
+ /** Fades out a foreground ripple after it has fully expanded and faded in. */
155
149
fadeOutForegroundRipple ( ripple : Element ) {
156
150
ripple . classList . remove ( 'md-ripple-fade-in' ) ;
157
151
ripple . classList . add ( 'md-ripple-fade-out' ) ;
158
152
}
159
153
160
- /**
161
- * Removes a foreground ripple from the DOM after it has faded out.
162
- */
154
+ /** Removes a foreground ripple from the DOM after it has faded out. */
163
155
removeRippleFromDom ( ripple : Element ) {
164
156
ripple . parentElement . removeChild ( ripple ) ;
165
157
}
166
158
167
- /**
168
- * Fades in the ripple background.
169
- */
159
+ /** Fades in the ripple background. */
170
160
fadeInRippleBackground ( color : string ) {
171
161
this . _backgroundDiv . classList . add ( 'md-ripple-active' ) ;
172
162
// If color is not set, this will default to the background color defined in CSS.
173
163
this . _backgroundDiv . style . backgroundColor = color ;
174
164
}
175
165
176
- /**
177
- * Fades out the ripple background.
178
- */
166
+ /** Fades out the ripple background. */
179
167
fadeOutRippleBackground ( ) {
180
168
if ( this . _backgroundDiv ) {
181
169
this . _backgroundDiv . classList . remove ( 'md-ripple-active' ) ;
0 commit comments