simplify the assignment of this.target_

This commit is contained in:
Bart van den Eijnden
2013-11-05 16:52:24 +01:00
parent e6c4fd973a
commit 2fc884a3d9
2 changed files with 5 additions and 7 deletions

View File

@@ -30,12 +30,10 @@ ol.control.Control = function(options) {
/**
* @private
* @type {Element|undefined}
* @type {?Element}
*/
this.target_ = goog.isDef(options.target) ? (goog.isString(options.target) ?
goog.dom.getElement(options.target) !== null ?
goog.dom.getElement(options.target) : undefined : options.target) :
undefined;
this.target_ = goog.isDef(options.target) ?
goog.dom.getElement(options.target) : null;
/**
* @private
@@ -98,7 +96,7 @@ ol.control.Control.prototype.setMap = function(map) {
}
this.map_ = map;
if (!goog.isNull(this.map_)) {
var target = goog.isDef(this.target_) ?
var target = !goog.isNull(this.target_) ?
this.target_ : map.getOverlayContainerStopEvent();
goog.dom.appendChild(target, this.element);
if (this.handleMapPostrender !== goog.nullFunction) {