Skip to content

Commit

Permalink
Popup/Tooltip content function: allow return undefined
Browse files Browse the repository at this point in the history
In this case Popup/Tooltip is not shown.

Usefull when only some sublayers need popups:
- previously: it was necessary to attach independent popups to each sublayer
- now: it's enough to have common content function attached to parent layer
  • Loading branch information
johndoe committed Apr 15, 2019
1 parent e079588 commit d8a4ba0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/layer/DivOverlay.js
Expand Up @@ -164,7 +164,9 @@ export var DivOverlay = Layer.extend({
var node = this._contentNode;
var content = (typeof this._content === 'function') ? this._content(this._source || this) : this._content;

if (typeof content === 'string') {
if (!content) {
return;
} else if (typeof content === 'string') {
node.innerHTML = content;
} else {
while (node.hasChildNodes()) {
Expand Down

0 comments on commit d8a4ba0

Please sign in to comment.