Closed bjarketrux closed 3 years ago
Thank you @bjarketrux for finding this major issue and for the concise description. (It even affected the default resize detection too: applyEllipsis
wasn't called "exponentially", but the callback within addElementResizeListener
was. The performance impact was smaller than with window
detection, but still there.)
Fixed in ngx-ellipsis@3.1.1
There seems to be an event leak which results in exponential calls to
applyEllipsis()
when window is resized. It is only when usingellipsis-resize-detection="window"
!Steps to reproduce
ellipsis-resize-detection="window"
to any of the ellipsis DIVsObserve: The browser will slow down and resizing will become more sluggish. Debug: (Using chrome) navigate to "source" in DevTools and add a "logpoint" in the
ellipsis.directive.ts
inapplyEllipsis()
. This will log a message in the console every time the function is called. Observe that the function is executed exponentially on each resize of the window.