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

Conversation

oscar-sensornet
Copy link
Contributor

Adds the possibility to use a DOM Element instance as the html option for a DivIcon.

@@ -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.

@IvanSanchez IvanSanchez merged commit e079588 into Leaflet:master Apr 14, 2019
@oscar-sensornet oscar-sensornet deleted the divicon-html-element branch April 14, 2019 23:31
Schleuse pushed a commit to Schleuse/Leaflet that referenced this pull request Dec 3, 2019
* Make DivIcon html option accept Element

* Empty div with L.DomUtil.empty

* Docstrings for passing `HTMLElement` to DivIcon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants