Script concatenation fails to take external dependencies into account.
|Reported by:||jczorkmid||Owned by:|
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):
But when script3 is loaded externally, script4 will break:
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:
Or at least flagged the script with the dependency as unsafe for concatenation: