Make WordPress Core


Ignore:
Timestamp:
05/07/2022 02:51:54 AM (3 years ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class.wp-scripts.php

    r53283 r53360  
    311311            $inline_script_tag = '';
    312312        }
     313
     314        $translations_stop_concat = ! empty( $obj->textdomain );
    313315
    314316        $translations = $this->print_translations( $handle, false );
     
    328330            $srce = apply_filters( 'script_loader_src', $src, $handle );
    329331
    330             if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations ) ) {
     332            if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) {
    331333                $this->do_concat = false;
    332334
Note: See TracChangeset for help on using the changeset viewer.