Skip to content

Commit 7893263

Browse files
committed
MOBILE-4842 reading-mode: Fix renamed styles were added twice
1 parent 5bc5ac2 commit 7893263

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/core/directives/reading-mode.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,12 @@ export class CoreReadingModeDirective implements AfterViewInit, OnDestroy {
137137
this.disabledStyles = this.disabledStyles.concat(disabledStyles);
138138

139139
// Rename style attributes on DOM elements.
140-
const renamedStyles: HTMLElement[] = Array.from(element.querySelectorAll('*[style]'));
141-
renamedStyles.forEach((element: HTMLElement) => {
142-
this.renamedStyles.push(element);
140+
this.renamedStyles = Array.from(element.querySelectorAll('*[style]'));
141+
this.renamedStyles.forEach((element: HTMLElement) => {
143142
element.setAttribute('data-original-style', element.getAttribute('style') || '');
144143
element.removeAttribute('style');
145144
});
146145

147-
this.renamedStyles = this.renamedStyles.concat(renamedStyles);
148-
149146
// Navigate to parent hidding all other elements.
150147
let currentChild = element;
151148
let parent = currentChild.parentElement;

0 commit comments

Comments
 (0)