diff --git a/packages/mdc-linear-progress/component.ts b/packages/mdc-linear-progress/component.ts index 84d45bb90c7..16408e4bd34 100644 --- a/packages/mdc-linear-progress/component.ts +++ b/packages/mdc-linear-progress/component.ts @@ -33,27 +33,27 @@ export class MDCLinearProgress extends } set determinate(value: boolean) { - this.foundation_.setDeterminate(value); + this.foundation.setDeterminate(value); } set progress(value: number) { - this.foundation_.setProgress(value); + this.foundation.setProgress(value); } set buffer(value: number) { - this.foundation_.setBuffer(value); + this.foundation.setBuffer(value); } set reverse(value: boolean) { - this.foundation_.setReverse(value); + this.foundation.setReverse(value); } open() { - this.foundation_.open(); + this.foundation.open(); } close() { - this.foundation_.close(); + this.foundation.close(); } getDefaultFoundation() { @@ -61,34 +61,34 @@ export class MDCLinearProgress extends // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. const adapter: MDCLinearProgressAdapter = { addClass: (className: string) => { - this.root_.classList.add(className); + this.root.classList.add(className); }, forceLayout: () => { - this.root_.getBoundingClientRect(); + this.root.getBoundingClientRect(); }, setBufferBarStyle: (styleProperty: string, value: string) => { - const bufferBar = this.root_.querySelector( + const bufferBar = this.root.querySelector( MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR); if (bufferBar) { bufferBar.style.setProperty(styleProperty, value); } }, setPrimaryBarStyle: (styleProperty: string, value: string) => { - const primaryBar = this.root_.querySelector( + const primaryBar = this.root.querySelector( MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR); if (primaryBar) { primaryBar.style.setProperty(styleProperty, value); } }, - hasClass: (className: string) => this.root_.classList.contains(className), + hasClass: (className: string) => this.root.classList.contains(className), removeAttribute: (attributeName: string) => { - this.root_.removeAttribute(attributeName); + this.root.removeAttribute(attributeName); }, removeClass: (className: string) => { - this.root_.classList.remove(className); + this.root.classList.remove(className); }, setAttribute: (attributeName: string, value: string) => { - this.root_.setAttribute(attributeName, value); + this.root.setAttribute(attributeName, value); }, }; return new MDCLinearProgressFoundation(adapter); diff --git a/packages/mdc-linear-progress/foundation.ts b/packages/mdc-linear-progress/foundation.ts index 964e70de4e4..b3346df7401 100644 --- a/packages/mdc-linear-progress/foundation.ts +++ b/packages/mdc-linear-progress/foundation.ts @@ -61,9 +61,8 @@ export class MDCLinearProgressFoundation extends } init() { - this.isDeterminate = - !this.adapter_.hasClass(cssClasses.INDETERMINATE_CLASS); - this.isReversed = this.adapter_.hasClass(cssClasses.REVERSED_CLASS); + this.isDeterminate = !this.adapter.hasClass(cssClasses.INDETERMINATE_CLASS); + this.isReversed = this.adapter.hasClass(cssClasses.REVERSED_CLASS); this.progress = 0; this.buffer = 1; } @@ -72,8 +71,8 @@ export class MDCLinearProgressFoundation extends this.isDeterminate = isDeterminate; if (this.isDeterminate) { - this.adapter_.removeClass(cssClasses.INDETERMINATE_CLASS); - this.adapter_.setAttribute( + this.adapter.removeClass(cssClasses.INDETERMINATE_CLASS); + this.adapter.setAttribute( strings.ARIA_VALUENOW, this.progress.toString()); this.setPrimaryBarProgress(this.progress); this.setBufferBarProgress(this.buffer); @@ -87,13 +86,13 @@ export class MDCLinearProgressFoundation extends // the translate animation in order to keep it in sync with the new // scale animation that will start from adding INDETERMINATE_CLASS // below. - this.adapter_.removeClass(cssClasses.REVERSED_CLASS); - this.adapter_.forceLayout(); - this.adapter_.addClass(cssClasses.REVERSED_CLASS); + this.adapter.removeClass(cssClasses.REVERSED_CLASS); + this.adapter.forceLayout(); + this.adapter.addClass(cssClasses.REVERSED_CLASS); } - this.adapter_.addClass(cssClasses.INDETERMINATE_CLASS); - this.adapter_.removeAttribute(strings.ARIA_VALUENOW); + this.adapter.addClass(cssClasses.INDETERMINATE_CLASS); + this.adapter.removeAttribute(strings.ARIA_VALUENOW); this.setPrimaryBarProgress(1); this.setBufferBarProgress(1); } @@ -106,7 +105,7 @@ export class MDCLinearProgressFoundation extends this.progress = value; if (this.isDeterminate) { this.setPrimaryBarProgress(value); - this.adapter_.setAttribute(strings.ARIA_VALUENOW, value.toString()); + this.adapter.setAttribute(strings.ARIA_VALUENOW, value.toString()); } } @@ -130,25 +129,25 @@ export class MDCLinearProgressFoundation extends // reset the scale animation in order to keep it in sync with the new // translate animation that will start from adding/removing REVERSED_CLASS // below. - this.adapter_.removeClass(cssClasses.INDETERMINATE_CLASS); - this.adapter_.forceLayout(); - this.adapter_.addClass(cssClasses.INDETERMINATE_CLASS); + this.adapter.removeClass(cssClasses.INDETERMINATE_CLASS); + this.adapter.forceLayout(); + this.adapter.addClass(cssClasses.INDETERMINATE_CLASS); } if (this.isReversed) { - this.adapter_.addClass(cssClasses.REVERSED_CLASS); + this.adapter.addClass(cssClasses.REVERSED_CLASS); return; } - this.adapter_.removeClass(cssClasses.REVERSED_CLASS); + this.adapter.removeClass(cssClasses.REVERSED_CLASS); } open() { - this.adapter_.removeClass(cssClasses.CLOSED_CLASS); + this.adapter.removeClass(cssClasses.CLOSED_CLASS); } close() { - this.adapter_.addClass(cssClasses.CLOSED_CLASS); + this.adapter.addClass(cssClasses.CLOSED_CLASS); } private setPrimaryBarProgress(progressValue: number) { @@ -157,12 +156,12 @@ export class MDCLinearProgressFoundation extends // Accessing `window` without a `typeof` check will throw on Node environments. const transformProp = typeof window !== 'undefined' ? getCorrectPropertyName(window, 'transform') : 'transform'; - this.adapter_.setPrimaryBarStyle(transformProp, value); + this.adapter.setPrimaryBarStyle(transformProp, value); } private setBufferBarProgress(progressValue: number) { const value = `${progressValue * 100}%`; - this.adapter_.setBufferBarStyle(strings.FLEX_BASIS, value); + this.adapter.setBufferBarStyle(strings.FLEX_BASIS, value); } }