[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
Sat Apr 9 05:24:39 UTC 2016


#36392: wp_add_inline_script() breaks script dependency order when using script
loader (no SCRIPT_DEBUG)
----------------------------------------+-------------------------
 Reporter:  westonruter                 |       Owner:  swissspidy
     Type:  defect (bug)                |      Status:  assigned
 Priority:  high                        |   Milestone:  4.5
Component:  Script Loader               |     Version:  trunk
 Severity:  major                       |  Resolution:
 Keywords:  has-unit-tests needs-patch  |     Focuses:
----------------------------------------+-------------------------

Comment (by azaozz):

 > One way to implement this is to add load-scripts.php?… via
 $wp_scripts->add(…) multiple times.

 Right. However that will make calculating the dependencies pretty complex.
 We will probably need to be able to go back and re-calculate things when a
 previously enqueued dependency has to be moved to another "chain" of
 concatenated scripts.

 > I explored many options today and everything eventually comes back to
 this. HTTP/2 is an argument as well.
 >
 > However, are we confident in disabling concatenating in this case? Will
 this confuse developers expecting concatenated scripts all the time?

 On a "script heavy" wp-admin screens this will probably be noticeable.
 However don't think we have much choice. If we want granular control,
 concatenating will be in the way. Even if we implement multiple calls to
 load-scripts.php, chances are several scripts will have "before" or
 "after" and we will end up with 3, 4, 5... different concatenated
 "pieces", making it quite less effective. (Generally the concatenated
 scripts are different for each wp-admin screen, so they aren't cached in
 the browser very often. Single scripts are the same on every screen so
 caching happens more frequently.)

 > Printing them individually is a sane way to maintain that control and is
 what we should be thinking about for HTTP/2.

 Agreed.

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


More information about the wp-trac mailing list