Skip to content

Commit 164af69

Browse files
committed
[AssetMapper] Remove async from the polyfill loading script
1 parent 5cab1e1 commit 164af69

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,10 @@ public function render(string|array $entryPoint, array $attributes = []): string
125125
}
126126

127127
$output .= <<<HTML
128-
<script async$scriptAttributes>
128+
<script$scriptAttributes>
129129
if (!HTMLScriptElement.supports || !HTMLScriptElement.supports('importmap')) (function () {
130130
const script = document.createElement('script');
131131
script.src = '{$this->escapeAttributeValue($polyfillPath, \ENT_NOQUOTES)}';
132-
script.setAttribute('async', 'async');
133132
{$this->createAttributesString($polyfillAttributes, "script.setAttribute('%s', '%s');", "\n ", \ENT_NOQUOTES)}
134133
document.head.appendChild(script);
135134
})();

src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,9 @@ public function testCustomScriptAttributes()
132132
]);
133133
$html = $renderer->render([]);
134134
$this->assertStringContainsString('<script type="importmap" something data-turbo-track="reload">', $html);
135-
$this->assertStringContainsString('<script async something data-turbo-track="reload">', $html);
135+
$this->assertStringContainsString('<script something data-turbo-track="reload">', $html);
136136
$this->assertStringContainsString(<<<EOTXT
137137
script.src = 'https://polyfillUrl.example';
138-
script.setAttribute('async', 'async');
139138
script.setAttribute('something', 'something');
140139
script.setAttribute('data-turbo-track', 'reload');
141140
EOTXT, $html);

0 commit comments

Comments
 (0)