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 2 commits
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
8 changes: 7 additions & 1 deletion src/layer/marker/DivIcon.js
@@ -1,5 +1,6 @@
import {Icon} from './Icon';
import {toPoint as point} from '../../geometry/Point';
import {empty} from '../../dom/DomUtil';

/*
* @class DivIcon
Expand Down Expand Up @@ -44,7 +45,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) {
empty(div);
div.appendChild(options.html);
} else {
div.innerHTML = options.html !== false ? options.html : '';
}

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