Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make DivIcon html option accept Element #6571

Merged
merged 3 commits into from Apr 14, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/layer/marker/DivIcon.js
Expand Up @@ -44,7 +44,12 @@ export var DivIcon = Icon.extend({
var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'),
options = this.options;

div.innerHTML = options.html !== false ? options.html : '';
if (options.html instanceof Element) {
div.innerHTML = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather see L.DomUtil.empty() in use here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. No problem.

div.appendChild(options.html);
} else {
div.innerHTML = options.html !== false ? options.html : '';
}

if (options.bgPos) {
var bgPos = point(options.bgPos);
Expand Down