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
over at http://github.com/marcelklehr/dom-ot it would be nice to have a way to find out the index a removed dom node had in its parent's childNodes NodeMap. Currently, there's only oldPreviousSibling, however, if that has also been removed, there's no way to find out which index it had.
The text was updated successfully, but these errors were encountered:
The way MutationObserver works, from which MutationSummary is built. The MutationObserver returns individual removal records but sometimes many at the same time.
var divs = document.querySelectorAll('div');
divs[2].remove();
divs[1].remove();
You'll receive an array containing both removals from the MutationObserver. divs[2]'s mutation previousElementSibling would be div[0] and div[1]'s mutation previousElementSibling would also be div[0]. Both the same.
You could then do some maths to figure out what the indexes were, but not necessarily the order they were in before removal. MutationSummary though, does add a little bit more complexity. A lookup of the old positioning should be possible.
Hey,
over at http://github.com/marcelklehr/dom-ot it would be nice to have a way to find out the index a removed dom node had in its parent's childNodes NodeMap. Currently, there's only oldPreviousSibling, however, if that has also been removed, there's no way to find out which index it had.
The text was updated successfully, but these errors were encountered: