Make WordPress Core

Opened 14 years ago

Last modified 5 years ago

#15833 new defect (bug)

Script concatenation fails to take external dependencies into account.

Reported by: jczorkmid's profile jczorkmid Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0
Component: Script Loader Keywords: needs-patch
Focuses: Cc:


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 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 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

Change History (3)

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to Future Release

#2 @nacin
11 years ago

  • Component changed from General to Script Loader

#3 @chriscct7
9 years ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.