This is an automated email from the ASF dual-hosted git repository. gerben pushed a commit to branch tweak-highlighter in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git
commit 226107b9f7a514c11c72b6f4881fc17ed7384f0f Author: Gerben <[email protected]> AuthorDate: Thu Jun 25 22:47:16 2020 +0200 nitpicking Replace replaceChild with replaceWith (or: In the function that invokes replaceChild, replace with replaceWith replaceChild) --- packages/dom/src/highlight-range.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/dom/src/highlight-range.ts b/packages/dom/src/highlight-range.ts index e18a6a4..043d739 100644 --- a/packages/dom/src/highlight-range.ts +++ b/packages/dom/src/highlight-range.ts @@ -46,8 +46,8 @@ export function highlightRange( // 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; @@ -132,10 +132,7 @@ function removeHighlight(highlightElement: HTMLElement) { // 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) {
