magento2
magento2 copied to clipboard
[W3C] Remove text/javascript from cookie script tag declaration
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”.
Hi @bhennesAdv. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.
- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
PR was open without adding automatic test as it's not necessary for this kind of change.
Let me know if you need more information or if this change is not relevant.
Kind Regards, Baptiste
Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @bhennesAdv,
Thanks for the report and collaboration!
We have tried to find out the same in official W3c portal, but haven’t found the same. Can you please share the link which stats the same?
Thanks
Hello @engcom-Hotel
Here is an example of a magento 2 website validator result : https://validator.w3.org/nu/?doc=https%3A%2F%2Fshop.landrover.co.uk%2Frange-rover%2Fthe-range-rover-collection
You can see a lot of warning with message : The type attribute is unnecessary for JavaScript resources
This is the kind of warning I'm trying to remove here. Here are some more information about it : https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type
Authors should omit the type attribute instead of redundantly setting it.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type
Authors are encouraged to omit the attribute if the script refers to JavaScript code rather than specify a MIME type.
Kind Regards, Baptiste
Thanks @bhennesAdv for providing the reference.
We are confirming this issue for further processing.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-15061 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Approved by Product Manager