Skip to content

Commit

Permalink
Merge pull request Turbo87#41 from haoliangyu/master
Browse files Browse the repository at this point in the history
allow setContent() to accept HTML DOM element object
  • Loading branch information
Turbo87 committed Mar 19, 2016
2 parents 390d902 + 68fb35f commit dbcb1e9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/L.Control.Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,19 @@ L.Control.Sidebar = L.Control.extend({
},

setContent: function (content) {
this.getContainer().innerHTML = content;
var container = this.getContainer();

if (typeof content === 'string') {
container.innerHTML = content;
} else {
// clean current content
while (container.firstChild) {
container.removeChild(container.firstChild);
}

container.appendChild(content);
}

return this;
},

Expand Down

0 comments on commit dbcb1e9

Please sign in to comment.