[wp-trac] [WordPress Trac] #14853: wp_add_inline_script()

WordPress Trac noreply at wordpress.org
Sat Jan 16 15:15:15 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 has-unit-tests  |     Focuses:
--------------------------------------+-------------------------
Changes (by swissspidy):

 * keywords:  has-patch needs-refresh needs-unit-tests => has-patch has-
     unit-tests


Comment:

 [attachment:14853.2.diff] includes two new tests for concatenated scripts,
 localized script data and even conditionals. It makes sure that
 conditionals (e.g. `<!--[if gte IE 9]>`) are always wrapped around inline
 scripts.

 Contrary to to localized script data, inline scripts are added to
 `$wp_scripts->print_html` when the output should be concatenated. That's
 why `test_wp_add_inline_script_concat()` might look strange at first, but
 apparently that's the way it works.

 @ocean90 Wanna have another look? :-)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/14853#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list