[wp-trac] [WordPress Trac] #36392: wp_add_inline_script() breaks script dependency order when using script loader (no SCRIPT_DEBUG)
WordPress Trac
noreply at wordpress.org
Fri Apr 1 04:48:13 UTC 2016
#36392: wp_add_inline_script() breaks script dependency order when using script
loader (no SCRIPT_DEBUG)
---------------------------+--------------------
Reporter: westonruter | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.5
Component: Script Loader | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
---------------------------+--------------------
Description changed by westonruter:
Old description:
> I've found that if an inline script is added via `wp_add_inline_script()`
> for a JS file registered in a plugin, if this script has a dependency on
> a core script that gets concatenated via `load-scripts.php`, the script
> dependency and the inline script will erroneously get printed ''before''
> the the script tag referencing `load-scripts.php` and the script it
> depends on.
>
> Here is a minimal test case:
> https://gist.github.com/westonruter/c8968edc125fd31ae2da4171ced8c62b
New description:
I've found that if an inline script is added via `wp_add_inline_script()`
for a JS file registered in a plugin, if this script has a dependency on a
core script that gets concatenated via `load-scripts.php`, the script
dependency and the inline script will erroneously get printed ''before''
the the script tag referencing `load-scripts.php` and the script it
depends on. This error only occurs when `SCRIPT_DEBUG` is `false`, since
this is when `load-scripts.php` is used.
Here is a minimal test case:
https://gist.github.com/westonruter/c8968edc125fd31ae2da4171ced8c62b
`wp_add_inline_script()` introduced in #14853.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36392#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list