[wp-trac] [WordPress Trac] #5003: WP_Scripts::print_scripts() is overly complicated

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 19 00:39:45 GMT 2007


#5003: WP_Scripts::print_scripts() is overly complicated
-------------------------+--------------------------------------------------
 Reporter:  mdawaffe     |       Owner:  anonymous
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  2.4      
Component:  General      |     Version:  2.2.3    
 Severity:  normal       |    Keywords:           
-------------------------+--------------------------------------------------
 WP_Scripts::print_scripts() calls two recursive functions.

  1. WP_Scripts::all_deps() builds a hierarchical array of dependencies.
  2. WP_Scripts::_print_scripts() reads that hierarchical array and echoes
 out a correctly ordered list of script tags.

 The function should instead call one recursive function that builds a
 correctly ordered array of scripts.  That simple array can then be
 processed non-recursively.

 The attached also adds a new filter, {{{print_scripts_array}}} that could
 be used to do final post-processing of the scripts to deal with things
 WP_Script's naive dependency system can't do.  Example: if prototype and
 jQuery are loaded on the same page, prototype should come first.

 It could use some testing.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5003>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list