From 78abd1b1036233eab102cb4a95ebd6dc5040cc73 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 5 Apr 2013 18:19:20 +0200 Subject: [PATCH] Minor attribution control clean-ups --- src/ol/control/attributioncontrol.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ol/control/attributioncontrol.js b/src/ol/control/attributioncontrol.js index 7c7b34457c..464143f53c 100644 --- a/src/ol/control/attributioncontrol.js +++ b/src/ol/control/attributioncontrol.js @@ -8,7 +8,6 @@ goog.require('goog.dom.TagName'); goog.require('goog.events'); goog.require('goog.object'); goog.require('goog.style'); -goog.require('ol'); goog.require('ol.Attribution'); goog.require('ol.FrameState'); goog.require('ol.MapEvent'); @@ -28,6 +27,10 @@ ol.control.Attribution = function(opt_options) { var options = goog.isDef(opt_options) ? opt_options : {}; + /** + * @private + * @type {Element} + */ this.ulElement_ = goog.dom.createElement(goog.dom.TagName.UL); var element = goog.dom.createDom(goog.dom.TagName.DIV, { @@ -60,9 +63,9 @@ ol.control.Attribution = function(opt_options) { /** * @private - * @type {Array.} + * @type {?number} */ - this.listenerKeys_ = null; + this.postrenderListenKey_ = null; }; goog.inherits(ol.control.Attribution, ol.control.Control); @@ -115,16 +118,14 @@ ol.control.Attribution.prototype.handleMapPostrender = function(mapEvent) { * @inheritDoc */ ol.control.Attribution.prototype.setMap = function(map) { - if (!goog.isNull(this.listenerKeys_)) { - goog.array.forEach(this.listenerKeys_, goog.events.unlistenByKey); - this.listenerKeys_ = null; + if (!goog.isNull(this.postrenderListenKey_)) { + goog.events.unlistenByKey(this.postrenderListenKey_); + this.postrenderListenKey_ = null; } goog.base(this, 'setMap', map); if (!goog.isNull(map)) { - this.listenerKeys_ = [ - goog.events.listen(map, ol.MapEventType.POSTRENDER, - this.handleMapPostrender, false, this) - ]; + this.postrenderListenKey_ = goog.events.listen( + map, ol.MapEventType.POSTRENDER, this.handleMapPostrender, false, this); } };