#51447 closed defect (bug) (duplicate)
"type" attribute is unnecessary for JavaScript resources.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | 5.5.1 |
| Component: | Script Loader | Keywords: | reporter-feedback |
| Focuses: | javascript | Cc: |
Description
Change History (3)
#1
@
5 years ago
- Component changed from General to Script Loader
- Keywords reporter-feedback added
- Severity changed from major to minor
#2
@
5 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
Hi there, thanks for the ticket!
Just to clarify the reply above, you can remove the type attributes with a snippet like this:
function mytheme_register_support() {
add_theme_support( 'html5', array( 'script', 'style' ) );
}
add_action( 'after_setup_theme', 'mytheme_register_support' );
This is mentioned in Miscellaneous Developer Focused Changes in 5.3 dev note:
In HTML5, the
typeattribute is not required for the<script>and<style>tags. Including the attribute on these tags (type="text/javascript", for example) will trigger a validation warning in HTML validation tools.
In WordPress 5.3, two new arguments are now supported for the
html5theme feature,scriptandstyle. When these arguments are passed, thetypeattribute will not be output for those tags.
See #42804 for more details.
Note: See
TracTickets for help on using
tickets.

Hello and welcome to trac, @mhimon. Thanks for the report.
This was earlier fixed in #42804.
I could not reproduce this in the Twenty Twenty theme using the latest WordPress version.
Can you help by sharing some more details of your setup - especially how jQuery script is enqueued?
Further, the notice that you see is only a
warning- which means the site will continue to work without any issue. Hence, I'm changing the severity of this ticket.