Skip to content

Commit bf5dc5a

Browse files
authored
Merge pull request #3477 from takluyver/i3473
Convert native for loop to Array forEach()
2 parents 70aa9a7 + 9e72e05 commit bf5dc5a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

notebook/static/tree/js/notebooklist.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ define([
254254
var files;
255255
if(dropOrForm === 'drop'){
256256
files = event.originalEvent.dataTransfer.files;
257-
} else
258-
{
257+
} else {
259258
files = event.originalEvent.target.files;
260259
}
261260

@@ -275,12 +274,11 @@ define([
275274
});
276275
};
277276

278-
for (var i = 0; i < files.length; i++) {
279-
var f = files[i];
277+
Array.from(files).forEach(function(f) {
280278
var name_and_ext = utils.splitext(f.name);
281279
var file_ext = name_and_ext[1];
282280

283-
if (f.size > this._max_upload_size_mb * 1024 * 1024) {
281+
if (f.size > that._max_upload_size_mb * 1024 * 1024) {
284282
var body_msg = i18n.msg.sprintf(i18n.msg._("The file size is %d MB. Do you still want to upload it?"),
285283
Math.round(f.size / (1024 * 1024)));
286284
dialog.modal({
@@ -314,7 +312,7 @@ define([
314312
reader.onload = reader_onload;
315313
reader.onerror = reader_onerror;
316314
}
317-
}
315+
});
318316
// Replace the file input form wth a clone of itself. This is required to
319317
// reset the form. Otherwise, if you upload a file, delete it and try to
320318
// upload it again, the changed event won't fire.

0 commit comments

Comments
 (0)