#53638 closed defect (bug) (worksforme)
Duplicate inline JS
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | blocker | Version: | 5.8 |
Component: | Script Loader | Keywords: | |
Focuses: | Cc: |
Description
in /wp-includes/class.wp-scripts.php
public function __construct() {
$this->init();
add_action( 'init', array( $this, 'init' ), 0 );
}
calls the init twice which leads to include the script twice as action
do_action_ref_array( 'wp_default_scripts', array( &$this ) );
Which then ends up with
<script id='lodash-js-after'>
window.lodash = _.noConflict();
window.lodash = _.noConflict();
</script>
on frontend.
This affects all scripts that use add inline script, basically bloating the frontend.
Change History (5)
#2
@
2 years ago
- Keywords reporter-feedback added
Hi @malthert,
I have not been able to reproduce the behavior you are describing.
Do you have any plugins active? Are you testing on a default theme? Are there any steps someone needs to take in order to see this happening?
Note: See
TracTickets for help on using
tickets.
Update: it's not only bloating the frontend, in some cases (like the above example) it will cause js console errors making the site unusable