-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using for...in to loop on Arrays may break if Array.prototype is modified by the app #1539
Comments
efattal
pushed a commit
to efattal/Sortable
that referenced
this issue
Jun 14, 2019
efattal
pushed a commit
to efattal/Sortable
that referenced
this issue
Jun 14, 2019
I have same issue |
Why does that even break the for...in loop? |
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. |
Solved in commit 854fed7. |
elo7-developer
pushed a commit
to elo7/Sortable
that referenced
this issue
Nov 18, 2019
Runi-c
pushed a commit
to Tupperbox/Sortable
that referenced
this issue
Nov 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem:
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
JSBin/JSFiddle demonstrating the problem:
http://jsfiddle.net/efattal/zv2h8bnx/1/
The text was updated successfully, but these errors were encountered: