#51447 closed defect (bug) (duplicate)
"type" attribute is unnecessary for JavaScript resources.
| Reported by: | mhimon | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Script Loader | Version: | 5.5.1 |
| Severity: | minor | Keywords: | reporter-feedback |
| Cc: | Focuses: | javascript |
Description
Change History (3)
#1
@
6 years ago
- Component General → Script Loader
- Keywords reporter-feedback added
- Severity major → minor
#2
@
6 years ago
- Milestone Awaiting Review
- Resolution → duplicate
- Status new → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)

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.