nitpicking
Replace replaceChild with replaceWith (or: In the function that invokes
replaceChild, replace with replaceWith replaceChild)
diff --git a/packages/dom/src/highlight-range.ts b/packages/dom/src/highlight-range.ts
index 922da67..90528a7 100644
--- a/packages/dom/src/highlight-range.ts
+++ b/packages/dom/src/highlight-range.ts
@@ -46,8 +46,8 @@
// Return a function that cleans up the highlightElements.
function removeHighlights() {
// Remove each of the created highlightElements.
- for (const highlightIdx in highlightElements) {
- removeHighlight(highlightElements[highlightIdx]);
+ for (const highlightElement of highlightElements) {
+ removeHighlight(highlightElement);
}
}
return removeHighlights;
@@ -133,10 +133,7 @@
// If it has somehow been removed already, there is nothing to be done.
if (!highlightElement.parentNode) return;
if (highlightElement.childNodes.length === 1) {
- highlightElement.parentNode.replaceChild(
- highlightElement.firstChild as ChildNode,
- highlightElement,
- );
+ highlightElement.replaceWith(highlightElement.firstChild as Node);
} else {
// If the highlight somehow contains multiple nodes now, move them all.
while (highlightElement.firstChild) {