diff --git a/src/ol/control/control.js b/src/ol/control/control.js index a640b2beca..ad7ab15f7e 100644 --- a/src/ol/control/control.js +++ b/src/ol/control/control.js @@ -49,6 +49,15 @@ ol.control.Control = function(controlOptions) { goog.inherits(ol.control.Control, goog.Disposable); +/** + * @inheritDoc + */ +ol.control.Control.prototype.disposeInternal = function() { + goog.dom.removeNode(this.element); + goog.base(this, 'disposeInternal'); +}; + + /** * @return {ol.Map} Map. */ diff --git a/src/ol/map.js b/src/ol/map.js index fe147e1541..9ed3f64a5f 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -290,6 +290,16 @@ ol.Map.prototype.canRotate = function() { }; +/** + * + * @inheritDoc + */ +ol.Map.prototype.disposeInternal = function() { + goog.dom.removeNode(this.viewport_); + goog.base(this, 'disposeInternal'); +}; + + /** * @param {ol.Extent} extent Extent. */ diff --git a/src/ol/mapbrowserevent.js b/src/ol/mapbrowserevent.js index b5b8d49481..63b3c956cd 100644 --- a/src/ol/mapbrowserevent.js +++ b/src/ol/mapbrowserevent.js @@ -285,9 +285,11 @@ ol.MapBrowserEventHandler.prototype.disposeInternal = function() { this.handleUp_, false, this); goog.events.unlisten(element, goog.events.EventType.CLICK, this.click_, false, this); - goog.asserts.assert(goog.isDef(this.dragListenerKeys_)); - goog.array.forEach(this.dragListenerKeys_, goog.events.unlistenByKey); - this.dragListenerKeys_ = null; + if (!goog.isNull(this.dragListenerKeys_)) { + goog.array.forEach(this.dragListenerKeys_, goog.events.unlistenByKey); + this.dragListenerKeys_ = null; + } + goog.base(this, 'disposeInternal'); }; diff --git a/test/ol.html b/test/ol.html index d504a2059c..1d438b53cd 100644 --- a/test/ol.html +++ b/test/ol.html @@ -83,6 +83,7 @@ +