From 09943b5e6ab2051d3e34964f904c0cb799d07645 Mon Sep 17 00:00:00 2001 From: Compufreak345 Date: Sun, 2 Aug 2015 17:56:23 +0200 Subject: [PATCH 1/3] Fix popup not filled with dynamic content Not sure why Polymer.dom(this).innerHTML is empty while this.innerHTML is not. --- leaflet-popup.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/leaflet-popup.html b/leaflet-popup.html index 874cf64..4f31f77 100644 --- a/leaflet-popup.html +++ b/leaflet-popup.html @@ -16,7 +16,7 @@ } this.feature.unbindPopup(); // TODO: Hack, ignore -tag - var content = Polymer.dom(this).innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); + var content = this.innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); if (content) { this.feature.bindPopup(content); } @@ -28,4 +28,4 @@ } } } - \ No newline at end of file + From 32821eb6bdeb1a8abf7eac71558c8ca45948a551 Mon Sep 17 00:00:00 2001 From: Compufreak345 Date: Mon, 3 Aug 2015 16:46:48 +0200 Subject: [PATCH 2/3] Fix static popup content --- leaflet-popup.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/leaflet-popup.html b/leaflet-popup.html index 4f31f77..f5435e2 100644 --- a/leaflet-popup.html +++ b/leaflet-popup.html @@ -16,7 +16,10 @@ } this.feature.unbindPopup(); // TODO: Hack, ignore -tag - var content = this.innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); + var content = Polymer.dom(this).innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); + if(!content) { // above code does not work with dynamic content, below not with static content -.- + content = this.innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); + } if (content) { this.feature.bindPopup(content); } From 4f4efb299b4b4f7877c077d11cc45510ee2c2b1d Mon Sep 17 00:00:00 2001 From: Compufreak345 Date: Tue, 6 Oct 2015 14:10:24 +0200 Subject: [PATCH 3/3] Prefer this.innerHTML to Polymer.dom(this.innerHTML) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this.innerHTML does not contain calculated stuff like --- leaflet-popup.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/leaflet-popup.html b/leaflet-popup.html index f5435e2..074d145 100644 --- a/leaflet-popup.html +++ b/leaflet-popup.html @@ -16,15 +16,15 @@ } this.feature.unbindPopup(); // TODO: Hack, ignore -tag - var content = Polymer.dom(this).innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); - if(!content) { // above code does not work with dynamic content, below not with static content -.- - content = this.innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); + var content = this.innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); + if(!content) { // above code does not work with static content, below not with dynamic content -.- + content = Polymer.dom(this).innerHTML.replace(/<\/?leaflet-point[^>]*>/g, "").trim(); } if (content) { this.feature.bindPopup(content); } }, - + detached: function() { if (this.observer_) { this.observer_.disconnect();