removes opt_this from ol.Collection#forEach
this commit also removes all uses of the standard thisArg of Array#forEach.
This commit is contained in:
@@ -213,7 +213,7 @@ var _ol_interaction_Modify_ = function(options) {
|
||||
*/
|
||||
this.features_ = features;
|
||||
|
||||
this.features_.forEach(this.addFeature_, this);
|
||||
this.features_.forEach(this.addFeature_.bind(this));
|
||||
_ol_events_.listen(this.features_, CollectionEventType.ADD,
|
||||
this.handleFeatureAdd_, this);
|
||||
_ol_events_.listen(this.features_, CollectionEventType.REMOVE,
|
||||
|
||||
@@ -313,12 +313,12 @@ _ol_interaction_Select_.prototype.setMap = function(map) {
|
||||
var selectedFeatures =
|
||||
this.featureOverlay_.getSource().getFeaturesCollection();
|
||||
if (currentMap) {
|
||||
selectedFeatures.forEach(currentMap.unskipFeature, currentMap);
|
||||
selectedFeatures.forEach(currentMap.unskipFeature.bind(currentMap));
|
||||
}
|
||||
Interaction.prototype.setMap.call(this, map);
|
||||
this.featureOverlay_.setMap(map);
|
||||
if (map) {
|
||||
selectedFeatures.forEach(map.skipFeature, map);
|
||||
selectedFeatures.forEach(map.skipFeature.bind(map));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ _ol_interaction_Snap_.prototype.setMap = function(map) {
|
||||
if (currentMap) {
|
||||
keys.forEach(_ol_events_.unlistenByKey);
|
||||
keys.length = 0;
|
||||
features.forEach(this.forEachFeatureRemove_, this);
|
||||
features.forEach(this.forEachFeatureRemove_.bind(this));
|
||||
}
|
||||
_ol_interaction_Pointer_.prototype.setMap.call(this, map);
|
||||
|
||||
@@ -322,7 +322,7 @@ _ol_interaction_Snap_.prototype.setMap = function(map) {
|
||||
this.handleFeatureRemove_, this)
|
||||
);
|
||||
}
|
||||
features.forEach(this.forEachFeatureAdd_, this);
|
||||
features.forEach(this.forEachFeatureAdd_.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -613,7 +613,7 @@ _ol_interaction_Snap_.handleEvent_ = function(evt) {
|
||||
_ol_interaction_Snap_.handleUpEvent_ = function(evt) {
|
||||
var featuresToUpdate = _ol_obj_.getValues(this.pendingFeatures_);
|
||||
if (featuresToUpdate.length) {
|
||||
featuresToUpdate.forEach(this.updateFeature_, this);
|
||||
featuresToUpdate.forEach(this.updateFeature_.bind(this));
|
||||
this.pendingFeatures_ = {};
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user