Skip to content
This repository was archived by the owner on Jan 27, 2022. It is now read-only.

Commit b755ea7

Browse files
committed
refactor: use safe operation to update the overlay
1 parent d903513 commit b755ea7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

projects/ng-devtools-backend/src/lib/highlighter.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Type } from '@angular/core';
22

33
let overlay: any;
4-
let overlayContent: any;
4+
let overlayContent: HTMLElement;
55

66
declare const ng: any;
77

@@ -120,7 +120,11 @@ function showOverlay(
120120
overlay.style.top = ~~top + 'px';
121121
overlay.style.left = ~~left + 'px';
122122

123-
overlayContent.innerHTML = '';
123+
while (overlayContent.children.length) {
124+
const { children } = overlayContent;
125+
overlayContent.removeChild(children[children.length - 1]);
126+
}
127+
124128
content.forEach((child) => overlayContent.appendChild(child));
125129

126130
document.body.appendChild(overlay);

0 commit comments

Comments
 (0)