Use normal for-loop instead of for (… in …)
authorJoshua Rüsweg <josh@bastelstu.be>
Thu, 31 Jan 2019 14:27:43 +0000 (15:27 +0100)
committerJoshua Rüsweg <josh@bastelstu.be>
Thu, 31 Jan 2019 14:27:43 +0000 (15:27 +0100)
See #2825

wcfsetup/install/files/js/WoltLabSuite/Core/Ui/File/Upload.js

index 5cb625eed8bb8faa20d9374f5408e204cf4104be..4edb7e5952fd98fa2482e420fd63e076381d1aec 100644 (file)
@@ -105,7 +105,7 @@ define(['Core', 'Language', 'Dom/Util', 'WoltLabSuite/Core/Ui/File/Delete', 'Upl
                },
                
                _failure: function(uploadId, data, responseText, xhr, requestOptions) {
-                       for (var i in this._fileElements[uploadId]) {
+                       for (var i = 0, length = this._fileElements[uploadId].length; i < length; i++) {
                                this._fileElements[uploadId][i].classList.add('uploadFailed');
                                
                                elBySel('small', this._fileElements[uploadId][i]).innerHTML = '';
@@ -130,7 +130,7 @@ define(['Core', 'Language', 'Dom/Util', 'WoltLabSuite/Core/Ui/File/Delete', 'Upl
                },
                
                _success: function(uploadId, data, responseText, xhr, requestOptions) {
-                       for (var i in this._fileElements[uploadId]) {
+                       for (var i = 0, length = this._fileElements[uploadId].length; i < length; i++) {
                                if (data['files'][i] !== undefined) {
                                        if (this._options.imagePreview) {
                                                if (data['files'][i].image === null) {