diff --git a/src/ol/map.js b/src/ol/map.js index 13c5efccbf..bcfa364b5b 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -1118,10 +1118,8 @@ ol.Map.prototype.handleLayerGroupPropertyChanged_ = function(event) { */ ol.Map.prototype.handleLayerGroupChanged_ = function() { if (!goog.isNull(this.layerGroupPropertyListenerKeys_)) { - var length = this.layerGroupPropertyListenerKeys_.length; - for (var i = 0; i < length; ++i) { - goog.events.unlistenByKey(this.layerGroupPropertyListenerKeys_[i]); - } + goog.array.forEach(this.layerGroupPropertyListenerKeys_, + goog.events.unlistenByKey); this.layerGroupPropertyListenerKeys_ = null; } var layerGroup = this.getLayerGroup(); diff --git a/test/spec/ol/source/bingmapssource.test.js b/test/spec/ol/source/bingmapssource.test.js index 3abe87976d..a53a9f63a1 100644 --- a/test/spec/ol/source/bingmapssource.test.js +++ b/test/spec/ol/source/bingmapssource.test.js @@ -27,7 +27,7 @@ describe('ol.source.BingMaps', function() { goog.net.Jsonp = googNetJsonp; var key = source.on('change', function() { if (source.getState() === 'ready') { - source.unByKey(key); + ol.Observable.unByKey(key); tileGrid = source.getTileGrid(); done(); } @@ -79,3 +79,4 @@ describe('ol.source.BingMaps', function() { goog.require('goog.net.Jsonp'); goog.require('ol.source.BingMaps'); goog.require('ol.tilecoord'); +goog.require('ol.Observable'); diff --git a/test/spec/ol/source/tilejsonsource.test.js b/test/spec/ol/source/tilejsonsource.test.js index b65b120298..68ee73caa2 100644 --- a/test/spec/ol/source/tilejsonsource.test.js +++ b/test/spec/ol/source/tilejsonsource.test.js @@ -40,7 +40,7 @@ describe('ol.source.TileJSON', function() { goog.net.Jsonp = googNetJsonp; var key = source.on('change', function() { if (source.getState() === 'ready') { - source.unByKey(key); + ol.Observable.unByKey(key); tileGrid = source.getTileGrid(); done(); } @@ -91,3 +91,4 @@ goog.require('goog.events'); goog.require('goog.net.Jsonp'); goog.require('ol.source.State'); goog.require('ol.source.TileJSON'); +goog.require('ol.Observable');