[wp-trac] [WordPress Trac] #53638: Duplicate inline JS
WordPress Trac
noreply at wordpress.org
Sat Jul 10 13:14:59 UTC 2021
#53638: Duplicate inline JS
---------------------------+-----------------------------
Reporter: malthert | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Script Loader | Version: trunk
Severity: blocker | Keywords:
Focuses: |
---------------------------+-----------------------------
in /wp-includes/class.wp-scripts.php
{{{#!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
{{{#!php
do_action_ref_array( 'wp_default_scripts', array( &$this ) );
}}}
Which then ends up with
{{{#!php
<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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53638>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list