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
We use a jQuery.event.special remove handler to write components that clean themselves up when they are removed from the DOM. We ran into an issue where certain components did not execute their cleanup. I've managed to trace it back to the fact that one of the components removed its own element from the DOM. This causes jQuery.cleanData to skip the next element in its list.
From what I can tell jQuery.cleanData iterates over a live list of elements. If one of the already traversed elements is removed from the DOM, all elements in the list behind it will move one index down. This causes the iteration to skip one element. For example, if it's cleaning up [0:A, 1:B, 2:C] and the cleanup of A removes itself, the list becomes [0:B, 1:C]; iteration continues at index 1, so B is skipped.
There are three elements that have the remove handler. When removed, they should log the contents of their data-ext attribute. Elements with the removeself class will remove themselves from the DOM. The first element does this, causing cleanData to skip the second one, but still cleanup the third.