diff --git a/src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php b/src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php index 48c869b00711c..87d557f6d422f 100644 --- a/src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php +++ b/src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php @@ -125,11 +125,10 @@ public function render(string|array $entryPoint, array $attributes = []): string } $output .= << + if (!HTMLScriptElement.supports || !HTMLScriptElement.supports('importmap')) (function () { const script = document.createElement('script'); script.src = '{$this->escapeAttributeValue($polyfillPath, \ENT_NOQUOTES)}'; - script.setAttribute('async', 'async'); {$this->createAttributesString($polyfillAttributes, "script.setAttribute('%s', '%s');", "\n ", \ENT_NOQUOTES)} document.head.appendChild(script); })(); diff --git a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php index a4770635c4e6d..ef519ff719b4b 100644 --- a/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php +++ b/src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php @@ -132,10 +132,9 @@ public function testCustomScriptAttributes() ]); $html = $renderer->render([]); $this->assertStringContainsString('