From 08422bb9dbde5285dfe35b5e2fffcf7e7787207a Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 14 Oct 2024 07:15:10 +0100 Subject: [PATCH] Avoid defining imgPathElement globally (#384) --- leaflet/static/leaflet/leaflet.extras.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/leaflet/static/leaflet/leaflet.extras.js b/leaflet/static/leaflet/leaflet.extras.js index 7c1c40e6..5b101de1 100644 --- a/leaflet/static/leaflet/leaflet.extras.js +++ b/leaflet/static/leaflet/leaflet.extras.js @@ -266,8 +266,10 @@ L.Map.djangoMap = function (id, options) { } }; -const imgPathElement = document.getElementById("force-img-path"); +{ + const imgPathElement = document.getElementById("force-img-path"); -if (!!imgPathElement) { + if (!!imgPathElement) { L.Icon.Default.imagePath = JSON.parse(imgPathElement.textContent); -} + } +} \ No newline at end of file