[wp-trac] [WordPress Trac] #20971: Delaying wp_default_scripts() prevents enqueing

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 26 21:39:43 UTC 2012


#20971: Delaying wp_default_scripts() prevents enqueing
------------------------------+---------------------
 Reporter:  nacin             |       Owner:  nacin
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:  3.4.1
Component:  General           |     Version:  3.4
 Severity:  major             |  Resolution:  fixed
 Keywords:  has-patch commit  |
------------------------------+---------------------

Comment (by nacin):

 Replying to [comment:12 azaozz]:
 > If we are going to continue supporting "bad" plugins, wouldn't it be
 better to abstract this
 >
 > {{{
 > did_action( 'init' ) && $scripts->localize( 'handle', 'handleL10n',
 array(...) );
 > }}}
 >
 > into another method? So add `localise_on_init()` or similar to
 WP_Scripts and call that from script-loader.

 Maybe. I was mainly concerned with keeping the diff small and logic simple
 for 3.4.1. We discussed a few options in that IRC log.

 The main issue about supporting these "bad" plugins is that they have no
 idea they are doing things wrong because everything works as normal. The
 only exception is it breaks JS strings in localized installs, which most
 developers will never notice.

 For WP_Scripts to work before init was a flaw in our original API. We have
 been issuing `_doing_it_wrong()` since 3.3, and, along with the bugs in
 3.3 (fixed in 3.3.1) and 3.4 (fixed in 3.4.1), most developers have indeed
 fixed their stuff. So I'd probably hesitate to do anything further here.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20971#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list