diff --git a/service.js b/service.js index a1e9659..aa3efd9 100644 --- a/service.js +++ b/service.js @@ -254,8 +254,7 @@ class BesService { BesService.getNodesInRange(range).forEach(el => { if ( el === hostElement || - Array.from(hostElement.childNodes).includes(el) || - hostElement.contains(el) + Array.from(hostElement.childNodes).includes(el) ) { blockElements.add(service.getBlockParent(el)) } @@ -266,6 +265,8 @@ class BesService { service.removeChild(block) }) // Not a nice way to do it, but it works for now the repositionMistakes function is called before the DOM updates are finished. + // If users will experience performance issues, we can consider debouncing this function. + // The lagginess becomes noticeable if the text is long and has many grammar mistakes. setTimeout(() => { service.repositionMistakes() }, 0)