[wp-trac] [WordPress Trac] #14853: wp_add_inline_script()
WordPress Trac
noreply at wordpress.org
Sat Jan 16 12:58:48 UTC 2016
#14853: wp_add_inline_script()
-------------------------------------------------+-------------------------
Reporter: mattwiebe | Owner: swissspidy
Type: enhancement | Status: accepted
Priority: normal | Milestone: 4.5
Component: Script Loader | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch needs-refresh needs-unit- | Focuses:
tests |
-------------------------------------------------+-------------------------
Changes (by ocean90):
* keywords: has-patch has-unit-tests => has-patch needs-refresh needs-
unit-tests
Comment:
[attachment:14853.diff]:
* `print_inline_script()` returns always a boolean, but if
`$this->do_concat` is true the expected return value is the script because
of `$this->print_code .= $this->print_inline_script( $handle, 'before',
false );`. `print_inline_style()` does it right in this case.
* When using `wp_add_inline_script( 'common', 'console.log("before");',
'before' );` the script is printed after the localized data, but in concat
mode it's printed before. It should be always after the localized data
IMO.
* We don't have ID attributes for all the other script handling methods,
is there a use case why `add_inline_script()` should add one? (Note: In
concat mode the ID gets ignored.)
* Beside `jQuery.noConflict();` are there any other places where core
could benefit of the new methods? Maybe `wp_color_scheme_settings()`? (For
back-compat reasons I don't think we can remove the `noConflict()` line
for a while.)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/14853#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list