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
{{ message }}
Repository navigation
Using for...in to loop on Arrays may break if Array.prototype is modified by the app #1539
I would like to use Sortable in a WebComponent inside an app where old frameworks that I can hardly remove (PrototypeJS and ExtJS 3.4) override Array.prototype. Hence, Sortable breaks on drag-dropping when looping on arrays (like _detectNearestEmptySortable on sortables).
I submit a Pull Request that fixes the issue. #1540
It's reproducible in the fiddle. Just look at JS errors in devtools and you'll see. for...in gets added members as keys while the code is only expecting positions in the array. Hence it gets undefined values from the array.
Activity
Fix SortableJS#1539 (when Array.prototype is modified)
Fix SortableJS#1539 (when Array.prototype is modified)
imnottherobot commentedon Jun 17, 2019
I have same issue
owen-m1 commentedon Jun 17, 2019
Why does that even break the for...in loop?
efattal commentedon Jun 17, 2019
It's reproducible in the fiddle. Just look at JS errors in devtools and you'll see. for...in gets added members as keys while the code is only expecting positions in the array. Hence it gets undefined values from the array.
#1539: Better loop safety
owen-m1 commentedon Jun 23, 2019
Solved in commit 854fed7.
SortableJS#1539: Better loop safety
SortableJS#1539: Better loop safety