diff --git a/src/ol/map.js b/src/ol/map.js index 6acde91074..aa3c2a11cf 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -1024,13 +1024,7 @@ ol.Map.prototype.handleTargetChanged_ = function() { // If it's not now an Element we remove the viewport from the DOM. // If it's an Element we append the viewport element to it. - var target = this.getTarget(); - - /** - * @type {Element} - */ - var targetElement = goog.isDef(target) ? - goog.dom.getElement(target) : null; + var targetElement = this.getTargetElement(); this.keyHandler_.detach(); @@ -1431,12 +1425,7 @@ ol.Map.prototype.skipFeature = function(feature) { * @api stable */ ol.Map.prototype.updateSize = function() { - var target = this.getTarget(); - - /** - * @type {Element} - */ - var targetElement = goog.isDef(target) ? goog.dom.getElement(target) : null; + var targetElement = this.getTargetElement(); if (goog.isNull(targetElement)) { this.setSize(undefined);