Replace removeChild with remove (#213465)

* Replace removeChild with remove

This replaces most uses of `parent.removeChild(child)` with
`child.remove()`.

The two are almost equivalent. The only difference is that
`parent.removeChild(child)` throws if the given node is not a child of
the parent, whereas `child.remove()` never throws. There is no noticable
performance difference. The only reason to use `removeChild` is to
support Internet Explorer, but that’s no longer supported by Monaco
editor.

* Fix broken CSP hash

The script content changed, so the sha256 hash changed too.

* Update src/vs/editor/browser/config/charWidthReader.ts

Co-authored-by: Logan Ramos <lramos15@gmail.com>

---------

Co-authored-by: Logan Ramos <lramos15@gmail.com>
This commit is contained in:
Remco Haszing
2024-06-05 00:21:08 +02:00
committed by GitHub
parent 5ca72043a3
commit a131a88231
75 changed files with 116 additions and 172 deletions

View File

@@ -11,7 +11,7 @@ import { formatStackTrace } from './stackTraceHelper';
function clearContainer(container: HTMLElement) {
while (container.firstChild) {
container.removeChild(container.firstChild);
container.firstChild.remove();
}
}
@@ -378,7 +378,7 @@ function renderStream(outputInfo: OutputWithAppend, outputElement: HTMLElement,
contentParent = document.createElement('div');
contentParent.appendChild(newContent);
while (outputElement.firstChild) {
outputElement.removeChild(outputElement.firstChild);
outputElement.firstChild.remove();
}
outputElement.appendChild(contentParent);
}