diff --git a/src/ol/map.js b/src/ol/map.js index 4ee6642c5f..268bc08e28 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -645,6 +645,19 @@ goog.exportProperty( ol.Map.prototype.getTarget); +/** + * Get the DOM element into which this map is rendered. In contrast to + * `getTarget` this method always return an `Element`, or `null` if the + * map has no target. + * @return {Element} The element that the map is rendered in. + * @api + */ +ol.Map.prototype.getTargetElement = function() { + var target = this.getTarget(); + return goog.isDef(target) ? goog.dom.getElement(target) : null; +}; + + /** * @param {ol.Pixel} pixel Pixel. * @return {ol.Coordinate} Coordinate.