diff --git a/src/ol/Collection.js b/src/ol/Collection.js index bca2a49ba8..8e8abff5a8 100644 --- a/src/ol/Collection.js +++ b/src/ol/Collection.js @@ -115,8 +115,7 @@ Collection.prototype.clear = function() { * @api */ Collection.prototype.extend = function(arr) { - let i, ii; - for (i = 0, ii = arr.length; i < ii; ++i) { + for (let i = 0, ii = arr.length; i < ii; ++i) { this.push(arr[i]); } return this; @@ -225,8 +224,7 @@ Collection.prototype.push = function(elem) { */ Collection.prototype.remove = function(elem) { const arr = this.array_; - let i, ii; - for (i = 0, ii = arr.length; i < ii; ++i) { + for (let i = 0, ii = arr.length; i < ii; ++i) { if (arr[i] === elem) { return this.removeAt(i); } @@ -270,8 +268,7 @@ Collection.prototype.setAt = function(index, elem) { this.dispatchEvent( new CollectionEvent(CollectionEventType.ADD, elem)); } else { - let j; - for (j = n; j < index; ++j) { + for (let j = n; j < index; ++j) { this.insertAt(j, undefined); } this.insertAt(index, elem); diff --git a/src/ol/pointer/PointerEventHandler.js b/src/ol/pointer/PointerEventHandler.js index bd3f004fc2..588d168e8e 100644 --- a/src/ol/pointer/PointerEventHandler.js +++ b/src/ol/pointer/PointerEventHandler.js @@ -172,9 +172,8 @@ PointerEventHandler.prototype.registerSource = function(name, source) { */ PointerEventHandler.prototype.register_ = function() { const l = this.eventSourceList_.length; - let eventSource; for (let i = 0; i < l; i++) { - eventSource = this.eventSourceList_[i]; + const eventSource = this.eventSourceList_[i]; this.addEvents_(eventSource.getEvents()); } }; @@ -186,9 +185,8 @@ PointerEventHandler.prototype.register_ = function() { */ PointerEventHandler.prototype.unregister_ = function() { const l = this.eventSourceList_.length; - let eventSource; for (let i = 0; i < l; i++) { - eventSource = this.eventSourceList_[i]; + const eventSource = this.eventSourceList_[i]; this.removeEvents_(eventSource.getEvents()); } }; diff --git a/src/ol/pointer/TouchSource.js b/src/ol/pointer/TouchSource.js index 24be859017..6aedb98c82 100644 --- a/src/ol/pointer/TouchSource.js +++ b/src/ol/pointer/TouchSource.js @@ -219,9 +219,8 @@ TouchSource.prototype.processTouches_ = function(inEvent, inFunction) { function preventDefault() { inEvent.preventDefault(); } - let i, pointer; - for (i = 0; i < count; ++i) { - pointer = this.touchToPointer_(inEvent, touches[i]); + for (let i = 0; i < count; ++i) { + const pointer = this.touchToPointer_(inEvent, touches[i]); // forward touch preventDefaults pointer.preventDefault = preventDefault; inFunction.call(this, inEvent, pointer); @@ -237,9 +236,8 @@ TouchSource.prototype.processTouches_ = function(inEvent, inFunction) { */ TouchSource.prototype.findTouch_ = function(touchList, searchId) { const l = touchList.length; - let touch; for (let i = 0; i < l; i++) { - touch = touchList[i]; + const touch = touchList[i]; if (touch.identifier === searchId) { return true; } @@ -267,10 +265,9 @@ TouchSource.prototype.vacuumTouches_ = function(inEvent) { const count = keys.length; if (count >= touchList.length) { const d = []; - let i, key, value; - for (i = 0; i < count; ++i) { - key = keys[i]; - value = this.pointerMap[key]; + for (let i = 0; i < count; ++i) { + const key = keys[i]; + const value = this.pointerMap[key]; // Never remove pointerId == 1, which is mouse. // Touch identifiers are 2 smaller than their pointerId, which is the // index in pointermap. @@ -279,7 +276,7 @@ TouchSource.prototype.vacuumTouches_ = function(inEvent) { d.push(value.out); } } - for (i = 0; i < d.length; ++i) { + for (let i = 0; i < d.length; ++i) { this.cancelOut_(inEvent, d[i]); } } diff --git a/src/ol/proj.js b/src/ol/proj.js index e2633575b0..42e2ea8f0a 100644 --- a/src/ol/proj.js +++ b/src/ol/proj.js @@ -317,12 +317,11 @@ export function createTransformFromCoordinateTransform(coordTransform) { const length = input.length; const dimension = opt_dimension !== undefined ? opt_dimension : 2; const output = opt_output !== undefined ? opt_output : new Array(length); - let point, i, j; - for (i = 0; i < length; i += dimension) { - point = coordTransform([input[i], input[i + 1]]); + for (let i = 0; i < length; i += dimension) { + const point = coordTransform([input[i], input[i + 1]]); output[i] = point[0]; output[i + 1] = point[1]; - for (j = dimension - 1; j >= 2; --j) { + for (let j = dimension - 1; j >= 2; --j) { output[i + j] = input[i + j]; } }