Skip to content
This repository was archived by the owner on May 15, 2019. It is now read-only.

Commit 5bf673c

Browse files
committed
Don't use for ... of with Nodelists (fails in IE 10).
The only loop that needed changing was the `for (const item of items)`, but I changed them all, just to be safe. Test Plan: This code should run in IE 10 now. Auditors: emily, alex
1 parent eed26ad commit 5bf673c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

js/sortable.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,28 @@ const SortableArea = React.createClass({
8181
const oldItems = [];
8282
const newItems = [];
8383

84-
for (const item of this._dragItems) {
84+
for (let i = 0; i < this._dragItems.length; i++) {
85+
const item = this._dragItems[i];
8586
if (items.indexOf(item) < 0) {
8687
oldItems.push(item);
8788
}
8889
}
8990

90-
for (const item of items) {
91+
for (let i = 0; i < items.length; i++) {
92+
const item = items[i];
9193
if (this._dragItems.indexOf(item) < 0) {
9294
newItems.push(item);
9395
}
9496
}
9597

96-
for (const dragItem of newItems) {
98+
for (let i = 0; i < newItems.length; i++) {
99+
const dragItem = newItems[i];
97100
dragItem.addEventListener('dragstart', this._listenEvent);
98101
dragItem.addEventListener('drop', this._cancelEvent);
99102
}
100103

101-
for (const dragItem of oldItems) {
104+
for (let i = 0; i < oldItems.length; i++) {
105+
const dragItem = oldItems[i];
102106
dragItem.removeEventListener('dragstart', this._listenEvent);
103107
dragItem.removeEventListener('drop', this._cancelEvent);
104108
}

0 commit comments

Comments
 (0)