allow target to be specified as a string for controls, update the documentation to make more clear what element and target are for

This commit is contained in:
Bart van den Eijnden
2013-11-04 19:53:21 +01:00
parent b8b93d3349
commit e6c4fd973a
3 changed files with 33 additions and 3 deletions

View File

@@ -32,7 +32,10 @@ ol.control.Control = function(options) {
* @private
* @type {Element|undefined}
*/
this.target_ = options.target;
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;
/**
* @private