Closed
Description
Symfony version(s) affected
7.2.2
Description
Hi,
I've run a test with w3c validator and I get an error in the script tags generated by importMap :
Error: Element script must not have attribute async unless attribute src is also specified or unless attribute type is specified with value module.
From line 48, column 10; to line 48, column 23
</script><script async>↩if (!
The class concerned is ImportMapRender.php, line 128 :
$output .= <<<HTML
<script async$scriptAttributes>
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);
})();
</script>
HTML;
async in the script tag seems to be a problem.
How to reproduce
Use the import map in your symfony project.
In base.html.twig file, add this lines :
{% block javascripts %}
{% block importmap %}
{{ importmap('app') }}
{% endblock %}
{% endblock %}
Generate the html page and pas code in W3C validator : https://validator.w3.org/nu/#textarea
Possible Solution
No response
Additional Context
No response