From 6aaa8c44727b13735fc3b803150a773b99e931ca Mon Sep 17 00:00:00 2001 From: Aljaz Grilc Date: Wed, 10 Apr 2024 09:50:41 +0200 Subject: [PATCH] Add a comment about possible performance issues --- service.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)