From 85c03e0238e4bfcb9754d2da4d6d66e8559fe66f Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 4 Aug 2022 16:05:07 -0700 Subject: [PATCH] clearNode should use `replaceChildren` (#157169) The new-ish `replaceChildren` api lets us quickly remove all children of an html element without having to iterate through the children --- src/vs/base/browser/dom.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts index 8ef36bb32ab..14a2556b333 100644 --- a/src/vs/base/browser/dom.ts +++ b/src/vs/base/browser/dom.ts @@ -19,9 +19,7 @@ import { withNullAsUndefined } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; export function clearNode(node: HTMLElement): void { - while (node.firstChild) { - node.firstChild.remove(); - } + node.replaceChildren(); } /**