magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

[W3C] Remove text/javascript from cookie script tag declaration

Open bhennesAdv opened this issue 4 months ago • 3 comments

Preconditions and environment

  • Magento version : 2.4.7-p6
  • Anything else that would help a developer reproduce the bug : Standard instance/All frontend pages

Affected template : https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Theme/view/frontend/templates/js/cookie_status.phtml

Steps to reproduce

If you load the homepage, or any other frontend page, you will have the following tag :

<script type="text/javascript">document.querySelector("#cookie-status").style.display = "none";</script>

According to W3C for some time now, adding text/javascript to script tag is unnecessary and will trigger a warning : The type attribute is unnecessary for JavaScript resources.

Expected result

Same tag should be present without the text/javascript type attribute

<script>document.querySelector("#cookie-status").style.display = "none";</script>

Actual result

See steps to reproduce

Additional information

This is not really an issue, only an improvement of generated code quality. If there is a reason why type is set on this tag and not elsewhere, please let me know

Release note

No response

Triage and priority

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [x] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

bhennesAdv avatar Jun 11 '25 16:06 bhennesAdv