You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ge...@apache.org on 2020/06/25 21:41:52 UTC

[incubator-annotator] 02/04: Replace replaceChild with replaceWith

This is an automated email from the ASF dual-hosted git repository.

gerben pushed a commit to branch improve-range-stuff
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git

commit 462a3abdcbaafb45dc647408acb77ecda1f18026
Author: Gerben <ge...@treora.com>
AuthorDate: Thu Jun 25 22:47:16 2020 +0200

    Replace replaceChild with replaceWith
    
    Or: In the function that invokes replaceChild, replace with replaceWith replaceChild.
---
 packages/dom/src/highlight-range.ts | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/packages/dom/src/highlight-range.ts b/packages/dom/src/highlight-range.ts
index 091c24f..8c52530 100644
--- a/packages/dom/src/highlight-range.ts
+++ b/packages/dom/src/highlight-range.ts
@@ -129,10 +129,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) {