Manipulation: Make jQuery.cleanData not skip elements during cleanup
commit3cad5c435aa2333c39baa55a8bceb2b6bf1e2721
authorac-mmi <79802170+ac-mmi@users.noreply.github.com>
Tue, 10 Sep 2024 22:18:53 +0000 (11 03:48 +0530)
committerGitHub <noreply@github.com>
Tue, 10 Sep 2024 22:18:53 +0000 (11 00:18 +0200)
treed0574da799ad03019ff21a135c870ab16545dc82
parent6d78c0768d9aa6ba213678724c89af69a1958df6
Manipulation: Make jQuery.cleanData not skip elements during cleanup

When passing a result of `getElementByTagsName` to `jQuery.cleanData`, convert
it to an array first. Otherwise, a live NodeList is passed and if any of the
event cleanups remove the element itself, a collection is modified during the
iteration, making `jQuery.cleanData` skip cleanup for some elements.

Fixes gh-5214
Closes gh-5523

Co-authored-by: Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
src/manipulation/getAll.js
test/unit/manipulation.js