add comment explaining isMutationBelongsToElement behaviour in case of adding/removing the passed element itself

This commit is contained in:
Kanstantsin_Vikhor 2024-02-28 13:46:41 +04:00
parent df7fdcbf56
commit 7cd05fe6eb

View file

@ -11,6 +11,9 @@ export function isMutationBelongsToElement(mutationRecord: MutationRecord, eleme
return true;
}
/**
* In case of removing/adding the element itself, mutation type will be 'childList' and 'removedNodes'/'addedNodes' will contain the element.
*/
if (type === 'childList') {
const elementAddedItself = Array.from(addedNodes).some(node => node === element);
if (elementAddedItself) {