[wp-trac] [WordPress Trac] #15833: Script concatenation fails to take external dependencies into account.

WordPress Trac wp-trac at lists.automattic.com
Wed Dec 15 17:35:17 UTC 2010


#15833: Script concatenation fails to take external dependencies into account.
--------------------------+-----------------------------
 Reporter:  jczorkmid     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.0
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Script concatenation places the concatenated script include first, before
 any scripts loaded separately.  If one of the scripts in the concatenation
 relies on a script outside the concatenation the dependency order is
 ignored.

 When the dependencies are all internal to the concatenation things work
 fine (for example script4 relies on script3):

 * concat=script1,script2,script3,script4,script5

 But when script3 is loaded externally, script4 will break:

 * concat=script1,script2,script4,script5
 * external-script3

 This becomes apparent if jQuery is loaded from a non-standard location
 (via a plugin or the
 [http://codex.wordpress.org/Function_Reference/wp_enqueue_script
 #Load_a_default_WordPress_script_from_a_non-default_location code from the
 Codex]) in that the visual editor fails to function correctly because
 source:/trunk/wp-admin/js/editor.js uses jQuery (which it fails to
 register as a dependency, see ticket:15830, but when I fixed that locally
 the results were the same).

 I'm working around this in [http://wordpress.org/extend/plugins/use-
 google-libraries/ Use Google Libraries] by globally disabling
 concatenation, but it would be nice if this was fixed.


 If possible, it would be nice if the loader was smart enough to do
 something like:

 * concat=script1,script2
 * external-script3
 * concat=script4,script5

 Or at least flagged the script with the dependency as unsafe for
 concatenation:

 * concat=script1,script2,script5
 * external-script3
 * script4

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


More information about the wp-trac mailing list