Skip to content

Commit e3830b4

Browse files
jelbournkara
authored andcommitted
chore: fix closure compiler warning in ripple (#1904)
1 parent c54617c commit e3830b4

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

src/lib/core/ripple/ripple-renderer.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class RippleRenderer {
4242
private _backgroundDiv: HTMLElement;
4343
private _rippleElement: HTMLElement;
4444
private _triggerElement: HTMLElement;
45+
_opacity: string;
4546

4647
constructor(_elementRef: ElementRef, private _eventHandlers: Map<string, (e: Event) => void>) {
4748
this._rippleElement = _elementRef.nativeElement;
@@ -50,9 +51,7 @@ export class RippleRenderer {
5051
this._backgroundDiv = null;
5152
}
5253

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. */
5655
createBackgroundIfNeeded() {
5756
if (!this._backgroundDiv) {
5857
this._backgroundDiv = document.createElement('div');
@@ -81,16 +80,12 @@ export class RippleRenderer {
8180
}
8281
}
8382

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. */
8784
setTriggerElementToHost() {
8885
this.setTriggerElement(this._rippleElement);
8986
}
9087

91-
/**
92-
* Removes event handlers from the current trigger element if needed.
93-
*/
88+
/** Removes event handlers from the current trigger element if needed. */
9489
clearTriggerElement() {
9590
this.setTriggerElement(null);
9691
}
@@ -137,7 +132,8 @@ export class RippleRenderer {
137132
rippleDiv.style.transitionDuration = `${fadeInSeconds}s`;
138133

139134
// 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;
141137

142138
rippleDiv.classList.add('md-ripple-fade-in');
143139
// Clearing the transform property causes the ripple to animate to its full size.
@@ -149,33 +145,25 @@ export class RippleRenderer {
149145
(event: TransitionEvent) => transitionEndCallback(ripple, event));
150146
}
151147

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. */
155149
fadeOutForegroundRipple(ripple: Element) {
156150
ripple.classList.remove('md-ripple-fade-in');
157151
ripple.classList.add('md-ripple-fade-out');
158152
}
159153

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. */
163155
removeRippleFromDom(ripple: Element) {
164156
ripple.parentElement.removeChild(ripple);
165157
}
166158

167-
/**
168-
* Fades in the ripple background.
169-
*/
159+
/** Fades in the ripple background. */
170160
fadeInRippleBackground(color: string) {
171161
this._backgroundDiv.classList.add('md-ripple-active');
172162
// If color is not set, this will default to the background color defined in CSS.
173163
this._backgroundDiv.style.backgroundColor = color;
174164
}
175165

176-
/**
177-
* Fades out the ripple background.
178-
*/
166+
/** Fades out the ripple background. */
179167
fadeOutRippleBackground() {
180168
if (this._backgroundDiv) {
181169
this._backgroundDiv.classList.remove('md-ripple-active');

0 commit comments

Comments
 (0)