mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 03:04:34 +00:00
Script Loader: Fix i18n edge case breaking dependencies.
Prevent concatenation of scripts if the text domain is defined to ensure the dependency order is respected. This accounts for an edge case in which replacing a core script via a plugin and a lack of translations (eg, for a US English site) could cause the JavaScript files to be ordered incorrectly. Follow up to [52937]. Props audrasjb, boniu91, chaion07, costdev, hellofromtonya, jsnajdr, mukesh27, ndiego, ugyensupport. Fixes #55628. git-svn-id: https://develop.svn.wordpress.org/trunk@53360 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -311,6 +311,8 @@ class WP_Scripts extends WP_Dependencies {
|
||||
$inline_script_tag = '';
|
||||
}
|
||||
|
||||
$translations_stop_concat = ! empty( $obj->textdomain );
|
||||
|
||||
$translations = $this->print_translations( $handle, false );
|
||||
if ( $translations ) {
|
||||
$translations = sprintf( "<script%s id='%s-js-translations'>\n%s\n</script>\n", $this->type_attr, esc_attr( $handle ), $translations );
|
||||
@@ -327,7 +329,7 @@ class WP_Scripts extends WP_Dependencies {
|
||||
*/
|
||||
$srce = apply_filters( 'script_loader_src', $src, $handle );
|
||||
|
||||
if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations ) ) {
|
||||
if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) {
|
||||
$this->do_concat = false;
|
||||
|
||||
// Have to print the so-far concatenated scripts right away to maintain the right order.
|
||||
|
||||
Reference in New Issue
Block a user