You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
on-load works by hooking into a MutationObserver and listening for change events. These events are the very first thing that resolve on each frame.
Sometimes DOM nodes are briefly removed from the DOM, only to be immediately reinserted. Reordering / sorting lists is a common example of this. Because of how on-load is currently set up, even briefly removing an element from the DOM can cause the MutationObserver to trigger.
This makes it impossible to reorder lists of elements with onload() listeners attached.
Proposal
I propose we mitigate this by having on-load check if the node is still on the DOM by the time the MutationObserver resolves, so list reordering can be performed. My gut feeling tells me this shouldn't cause any significant performance overhead. Thanks!
Problem
on-load
works by hooking into aMutationObserver
and listening for change events. These events are the very first thing that resolve on each frame.Sometimes DOM nodes are briefly removed from the DOM, only to be immediately reinserted. Reordering / sorting lists is a common example of this. Because of how
on-load
is currently set up, even briefly removing an element from the DOM can cause theMutationObserver
to trigger.This makes it impossible to reorder lists of elements with
onload()
listeners attached.Proposal
I propose we mitigate this by having
on-load
check if the node is still on the DOM by the time theMutationObserver
resolves, so list reordering can be performed. My gut feeling tells me this shouldn't cause any significant performance overhead. Thanks!See Also
The text was updated successfully, but these errors were encountered: