#24796 closed defect (bug) (invalid)
wp_enqueue_script causing HTML5 Validation Error
Reported by: | tislam100 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.5.2 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
Some plugins are using wp_enqueue_script to display inline javascript without src. the output of those scripts should be like this:
<script type="text/javascript"> custom javascript </script>
but it adds the extra charset="utf-8" attribute which is not valid in html5 without a src.
<script type="text/javascript" charset="utf-8"> custom javascript </script>
wp_enqueue_script should check whether the called script has a src, if not, then dont add the charset attribute. Imo this should be treated seriously as most of the themes are now html5. and the html5 validity status of this issue is "Error", not a "Notice".
Thanks
Change History (7)
#2
@
11 years ago
wp_enqueue_script should check whether the called script has a src
Related: #22470
#3
@
11 years ago
Sorry guys. should have searched before.
Is this going to be fixed in the next version?
Thanks
#4
in reply to:
↑ 1
@
11 years ago
Per my comment above:
Replying to nacin:
I'm not aware of the scripts API supporting or using the charset attribute, or even supporting inline JavaScript in such a way.
I don't see how this is a bug in core. We don't go near the charset attribute when printing <script>
tags.
#5
@
11 years ago
yes Nacin you are correct. As i looked into the class.wp-scripts.php looks like wordpress doesn't.
Looks like its caused by a plugin.
you guys can discard this ticket as its invalid.
Sorry.
I'm not aware of the scripts API supporting or using the charset attribute, or even supporting inline JavaScript in such a way.