Skip to content

Commit

Permalink
chore: fix closure compiler warning in ripple (#1904)
Browse files Browse the repository at this point in the history
  • Loading branch information
jelbourn authored and kara committed Nov 17, 2016
1 parent c54617c commit e3830b4
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions src/lib/core/ripple/ripple-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class RippleRenderer {
private _backgroundDiv: HTMLElement;
private _rippleElement: HTMLElement;
private _triggerElement: HTMLElement;
_opacity: string;

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

/**
* Creates the div for the ripple background, if it doesn't already exist.
*/
/** Creates the div for the ripple background, if it doesn't already exist. */
createBackgroundIfNeeded() {
if (!this._backgroundDiv) {
this._backgroundDiv = document.createElement('div');
Expand Down Expand Up @@ -81,16 +80,12 @@ export class RippleRenderer {
}
}

/**
* Installs event handlers on the host element of the md-ripple directive.
*/
/** Installs event handlers on the host element of the md-ripple directive. */
setTriggerElementToHost() {
this.setTriggerElement(this._rippleElement);
}

/**
* Removes event handlers from the current trigger element if needed.
*/
/** Removes event handlers from the current trigger element if needed. */
clearTriggerElement() {
this.setTriggerElement(null);
}
Expand Down Expand Up @@ -137,7 +132,8 @@ export class RippleRenderer {
rippleDiv.style.transitionDuration = `${fadeInSeconds}s`;

// https://timtaubert.de/blog/2012/09/css-transitions-for-dynamically-created-dom-elements/
window.getComputedStyle(rippleDiv).opacity;
// Store the opacity to prevent this line as being seen as a no-op by optimizers.
this._opacity = window.getComputedStyle(rippleDiv).opacity;

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

/**
* Fades out a foreground ripple after it has fully expanded and faded in.
*/
/** Fades out a foreground ripple after it has fully expanded and faded in. */
fadeOutForegroundRipple(ripple: Element) {
ripple.classList.remove('md-ripple-fade-in');
ripple.classList.add('md-ripple-fade-out');
}

/**
* Removes a foreground ripple from the DOM after it has faded out.
*/
/** Removes a foreground ripple from the DOM after it has faded out. */
removeRippleFromDom(ripple: Element) {
ripple.parentElement.removeChild(ripple);
}

/**
* Fades in the ripple background.
*/
/** Fades in the ripple background. */
fadeInRippleBackground(color: string) {
this._backgroundDiv.classList.add('md-ripple-active');
// If color is not set, this will default to the background color defined in CSS.
this._backgroundDiv.style.backgroundColor = color;
}

/**
* Fades out the ripple background.
*/
/** Fades out the ripple background. */
fadeOutRippleBackground() {
if (this._backgroundDiv) {
this._backgroundDiv.classList.remove('md-ripple-active');
Expand Down

0 comments on commit e3830b4

Please sign in to comment.