Problem/Motivation
On Drupal 10.6.7, at /admin/config/system/leaflet-more-maps/demo, no maps are rendered. JS console shows "Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '#~test-leaflet' is not a valid selector.". "test-leaflet" is the "Name of custom map #1 in the administrative UI" that I entered at /admin/config/system/leaflet-more-maps.
I have not entered any API keys; it would be good if the docs mentioned what layers are expected to be rendered without any keys entered.
drupal.js?v=10.6.7:64 Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '#~test-leaflet' is not a valid selector.
at i (once.js:158:24)
at a (once.js:280:5)
at Object.<anonymous> (leaflet.drupal.js?tdkta4:15:9)
at ce.each (jquery.min.js?v=3.7.1:2:3179)
at Object.attach (leaflet.drupal.js?tdkta4:10:9)
at drupal.js?v=10.6.7:166:24
at Array.forEach (<anonymous>)
at Drupal.attachBehaviors (drupal.js?v=10.6.7:162:34)
at HTMLUListElement.<anonymous> (ajax.js?v=10.6.7:1404:18)
at ce.each (jquery.min.js?v=3.7.1:2:3129)
/admin/reports/status reports Leaflet 1.9.4 library installed at modules/contrib/leaflet/js/leaflet/dist/leaflet.js. 46 maps available.
Comments
Comment #2
jonathan_hunt commentedComment #3
jonathan_hunt commentedIf I remove tildes on
"~$custom_map_key"instances in leaflet_more_maps.module then form at/admin/config/system/leaflet-more-maps/demoshows most maps (except those requiring API keys)Comment #4
ressaThanks for reporting, great find with the tilde. It first showed up in this "Upgrade to D8 post code freeze" refactoring commit August 2013: https://git.drupalcode.org/project/leaflet_more_maps/-/blob/a7034186237e...
The tilde seems to be a special case, see for example PHP Tilde Operator (~): Understanding Its Function and Why ~$a Returns -($a + 1), though I am not sure that's what it results in here?