BesService may be registered on any HTML element: <p>, <body>,
<whatever>... Not only <div>, <textarea> and CKEditor. Therefore, we
need more generic test to distinguish which resize strategy works best.
It provided partial implementation only: for BesDOMService. What about
CKEditor?
This was optimizing something that users could "potentially" experience.
I didn't experience any performance problems on texts with hundreds of
grammar mistakes. Let alone a typical text users would have.
Skipping repositionAllMarkup() provides temporary misalignment between
markup and text. Performance vs. aesthetics?
Not convinced.
Reverts: 32f4360de9a5d2654a338ecf590d8f5f5cae2fec
Proposed solution was not complete, match.highlights is not an array
without a good reason, so checking only match.highlights[0] is never
a good idea. Should a grammar mistake wrap across more lines of text,
match.highlights gets one element per each part of the _same_ grammar
that spans one line of text. By not checking them all, popup failed
to appear when clicking on a grammar mistake following on the next line
of text.
Furthermore, the solution only addressed BesTreeService.onClick(), while
the same logic should be applied to BesPlainTextService.onClick() too.
Previously, texts with numerous errors could cause performance issues due to the high frequency of function calls. With the new debouncing implementation, we effectively limit the rate at which the error handling function executes, thereby reducing potential lagginess and improving the overall user experience.
Refactor the click detection logic to check if the click was inside the rectangle of the highlight element, rather than relying on stored rectangle coordinates.
Additionally, this update eliminates the need to attach event listeners to the entire window or the parent elements of the host element, simplifying the event handling and potentially improving performance.