diff --git a/debug/tests/reuse_popups.html b/debug/tests/reuse_popups.html new file mode 100644 index 00000000..c202ecab --- /dev/null +++ b/debug/tests/reuse_popups.html @@ -0,0 +1,41 @@ + + + + Leaflet debug page + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/src/layer/marker/Marker.Popup.js b/src/layer/marker/Marker.Popup.js index 2171bbff..ec882efd 100644 --- a/src/layer/marker/Marker.Popup.js +++ b/src/layer/marker/Marker.Popup.js @@ -37,8 +37,13 @@ L.Marker.include({ .on('move', this._movePopup, this); } - this._popup = new L.Popup(options, this) - .setContent(content); + if (content instanceof L.Popup) { + L.setOptions(content, options); + this._popup = content; + } else { + this._popup = new L.Popup(options, this) + .setContent(content); + } return this; },