container-query-polyfill icon indicating copy to clipboard operation
container-query-polyfill copied to clipboard

Script breaks Leaflet implementation

Open MajPay opened this issue 1 year ago • 1 comments

When adding the polyfill like this:

<script src="container-query-polyfill.modern.js" async></script>

it may interfere with Leaflet implementations as it writes a function to the global "L" variable.

In my concrete case window.L is a function with the following content:

function L(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128||95===e}

When i add the script tag with type="module" it works but i dont know if it works correctly that way...

Do you have any advice or could you provide an update, that avoids messing with the window object?

MajPay avatar Oct 21 '24 13:10 MajPay

If someone has the same issues: I migrated to this loading for the moment:

<script type="module">if (!CSS.supports('container-type: inline-sizes')) import('container-query-polyfill.modern.js');</script>

MajPay avatar Oct 21 '24 14:10 MajPay