From 11195f48491163d6e4f71fd7d28185544628ac2e Mon Sep 17 00:00:00 2001 From: snkashis Date: Sun, 17 Feb 2013 13:31:27 -0500 Subject: [PATCH] allow Path.bindPopup to take existing popups as well. --- src/layer/vector/Path.Popup.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/layer/vector/Path.Popup.js b/src/layer/vector/Path.Popup.js index ff2a9b9f..b0962025 100644 --- a/src/layer/vector/Path.Popup.js +++ b/src/layer/vector/Path.Popup.js @@ -6,12 +6,15 @@ L.Path.include({ bindPopup: function (content, options) { - if (!this._popup || options) { - this._popup = new L.Popup(options, this); + if (content instanceof L.Popup) { + this._popup = content; + } else { + if (!this._popup || options) { + this._popup = new L.Popup(options, this); + } + this._popup.setContent(content); } - this._popup.setContent(content); - if (!this._popupHandlersAdded) { this .on('click', this._openPopup, this)