leaflet-map
leaflet-map copied to clipboard
Fix popup not filled with dynamic content
Not sure why Polymer.dom(this).innerHTML is empty while this.innerHTML is not - maybe this is a polymer issue, maybe I am doing something wrong setting the innerHTML. This (popup content not updating) happened when I did something like this :
ready : function() {
var that = this;
window.setTimeout(function(){that.injectMarkerTitle(that)},300);
},
injectMarkerTitle : function(that) {
that.$$('leaflet-marker').innerHTML = "<b>TEST!</b>";
}
It was fixed by using this.innerHTML instead of Polymer.dom(this).innerHTML in leaflet-popup.html . Not sure if this is the best solution, but I don't see it violating polymer guidelines, they only say we have to use Polymer.dom for manipulations (https://www.polymer-project.org/1.0/docs/devguide/local-dom.html#dom-api) - this is no manipulation.
If anyone knows of a better solution that would be awesome, as this workaround is kind of awkward.
/edit : Using Polymer.dom(that.$$('leaflet-marker')) instead of that.$$('leaflet-marker') worked even less reliable (even when using Polymer.dom.flush()), maybe this and that.$$ are already Polymer.dom-objects and that's why it does not work?