From 30d62af4d87d8a73d248ab64478b5b07609d3b02 Mon Sep 17 00:00:00 2001 From: Kristofer Baxter Date: Thu, 6 May 2021 12:05:59 -0500 Subject: [PATCH] Noticed these changes while refactoring on another branch (#34250) --- .../amp-story-auto-ads/0.1/amp-story-auto-ads.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/extensions/amp-story-auto-ads/0.1/amp-story-auto-ads.js b/extensions/amp-story-auto-ads/0.1/amp-story-auto-ads.js index 651e83beeec3..6cff00125596 100644 --- a/extensions/amp-story-auto-ads/0.1/amp-story-auto-ads.js +++ b/extensions/amp-story-auto-ads/0.1/amp-story-auto-ads.js @@ -46,6 +46,7 @@ import {getServicePromiseForDoc} from '../../../src/service'; import {CSS as progessBarCSS} from '../../../build/amp-story-auto-ads-progress-bar-0.1.css'; import {setStyle} from '../../../src/style'; import {CSS as sharedCSS} from '../../../build/amp-story-auto-ads-shared-0.1.css'; +import {toggleAttribute} from '../../../src/dom'; /** @const {string} */ const TAG = 'amp-story-auto-ads'; @@ -313,13 +314,11 @@ export class AmpStoryAutoAds extends AMP.BaseElement { const {DESKTOP_PANELS} = Attributes; this.adBadgeContainer_.removeAttribute(DESKTOP_PANELS); // TODO(#33969) can no longer be null when launched. - this.progressBarBackground_ && - this.progressBarBackground_.removeAttribute(DESKTOP_PANELS); + this.progressBarBackground_?.removeAttribute(DESKTOP_PANELS); if (uiState === UIType.DESKTOP_PANELS) { this.adBadgeContainer_.setAttribute(DESKTOP_PANELS, ''); - this.progressBarBackground_ && - this.progressBarBackground_.setAttribute(DESKTOP_PANELS, ''); + this.progressBarBackground_?.setAttribute(DESKTOP_PANELS, ''); } }); } @@ -395,9 +394,7 @@ export class AmpStoryAutoAds extends AMP.BaseElement { return; } - isPaused - ? this.progressBarBackground_.setAttribute(Attributes.PAUSED, '') - : this.progressBarBackground_.removeAttribute(Attributes.PAUSED); + toggleAttribute(this.progressBarBackground_, Attributes.PAUSED, isPaused); } /**