diff --git a/js/leaflet.drupal.js b/js/leaflet.drupal.js
index bb4b34d..fb0a8f1 100644
--- a/js/leaflet.drupal.js
+++ b/js/leaflet.drupal.js
@@ -3,47 +3,49 @@
   Drupal.behaviors.leaflet = {
     attach: function(context, settings) {
 
-      $.each(settings.leaflet, function(m, data) {
-        $('#' + data.mapid, context).each(function() {
-          let $container = $(this);
-          let mapid = data.mapid;
-
-          // If the attached context contains any leaflet maps, make sure we have a Drupal.leaflet_widget object.
-          if ($container.data('leaflet') === undefined) {
-            $container.data('leaflet', new Drupal.Leaflet(L.DomUtil.get(mapid), mapid, data.map));
-            if (data.features.length > 0) {
-
-              // Initialize the Drupal.Leaflet.[data.mapid] object,
-              // for possible external interaction.
-              Drupal.Leaflet[mapid].markers = {};
-              Drupal.Leaflet[mapid].features = {};
-
-              // Add Leaflet Map Features.
-              $container.data('leaflet').add_features(mapid, data.features, true);
+      once('myLeafeltBehavior', 'html').forEach(function (element) {
+        $.each(settings.leaflet, function(m, data) {
+          $('#' + data.mapid, context).each(function() {
+            let $container = $(this);
+            let mapid = data.mapid;
+  
+            // If the attached context contains any leaflet maps, make sure we have a Drupal.leaflet_widget object.
+            if ($container.data('leaflet') === undefined) {
+              $container.data('leaflet', new Drupal.Leaflet(L.DomUtil.get(mapid), mapid, data.map));
+              if (data.features.length > 0) {
+  
+                // Initialize the Drupal.Leaflet.[data.mapid] object,
+                // for possible external interaction.
+                Drupal.Leaflet[mapid].markers = {};
+                Drupal.Leaflet[mapid].features = {};
+  
+                // Add Leaflet Map Features.
+                $container.data('leaflet').add_features(mapid, data.features, true);
+              }
+  
+              // Add the leaflet map to our settings object to make it accessible.
+              // @NOTE: This is used by the Leaflet Widget module.
+              data.lMap = $container.data('leaflet').lMap;
+  
+              // Set map position features.
+              $container.data('leaflet').fitbounds(mapid);
             }
-
-            // Add the leaflet map to our settings object to make it accessible.
-            // @NOTE: This is used by the Leaflet Widget module.
-            data.lMap = $container.data('leaflet').lMap;
-
-            // Set map position features.
-            $container.data('leaflet').fitbounds(mapid);
-          }
-
-          else {
-            // If we already had a map instance, add new features.
-            // @TODO Does this work? Needs testing.
-            if (data.features !== undefined) {
-              $container.data('leaflet').add_features(mapid, data.features);
+  
+            else {
+              // If we already had a map instance, add new features.
+              // @TODO Does this work? Needs testing.
+              if (data.features !== undefined) {
+                $container.data('leaflet').add_features(mapid, data.features);
+              }
             }
-          }
-          // After having initialized the Leaflet Map and added features,
-          // allow other modules to get access to it via trigger.
-          // NOTE: don't change this trigger arguments print, for back porting
-          // compatibility.
-          $(document).trigger('leafletMapInit', [data.map, data.lMap, mapid]);
-          // (Keep also the pre-existing event for back port compatibility)
-          $(document).trigger('leaflet.map', [data.map, data.lMap, mapid]);
+            // After having initialized the Leaflet Map and added features,
+            // allow other modules to get access to it via trigger.
+            // NOTE: don't change this trigger arguments print, for back porting
+            // compatibility.
+            $(document).trigger('leafletMapInit', [data.map, data.lMap, mapid]);
+            // (Keep also the pre-existing event for back port compatibility)
+            $(document).trigger('leaflet.map', [data.map, data.lMap, mapid]);
+          });
         });
       });
     }
diff --git a/js/leaflet.widget.js b/js/leaflet.widget.js
index 2af81ea..d6ad6a8 100644
--- a/js/leaflet.widget.js
+++ b/js/leaflet.widget.js
@@ -4,20 +4,22 @@
 (function ($, Drupal, drupalSettings) {
   Drupal.behaviors.leaflet_widget = {
     attach: function (context, settings) {
-      $.each(settings.leaflet_widget, function (map_id, widgetSettings) {
-        $('#' + map_id, context).each(function () {
-          let map = $(this);
-          // If the attached context contains any leaflet maps with widgets, make sure we have a
-          // Drupal.leaflet_widget object.
-          if (map.data('leaflet_widget') === undefined) {
-            let lMap = drupalSettings.leaflet[map_id].lMap;
-            map.data('leaflet_widget', new Drupal.leaflet_widget(map, lMap, widgetSettings));
-          }
-          else {
-            // If we already had a widget, update map to make sure that WKT and map are synchronized.
-            map.data('leaflet_widget').update_map();
-            map.data('leaflet_widget').update_input_state();
-          }
+      once('myLeafeltWidgetBehavior', 'html').forEach(function (element) {
+        $.each(settings.leaflet_widget, function (map_id, widgetSettings) {
+          $('#' + map_id, context).each(function () {
+            let map = $(this);
+            // If the attached context contains any leaflet maps with widgets, make sure we have a
+            // Drupal.leaflet_widget object.
+            if (map.data('leaflet_widget') === undefined) {
+              let lMap = drupalSettings.leaflet[map_id].lMap;
+              map.data('leaflet_widget', new Drupal.leaflet_widget(map, lMap, widgetSettings));
+            }
+            else {
+              // If we already had a widget, update map to make sure that WKT and map are synchronized.
+              map.data('leaflet_widget').update_map();
+              map.data('leaflet_widget').update_input_state();
+            }
+          });
         });
       });
     }
