Make WordPress Core


Ignore:
Timestamp:
05/09/2022 12:01:48 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, SergeyBiryukov.
Merges [53360,53366] to the 6.0 branch.
Fixes #55628.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/class.wp-scripts.php

    r53283 r53367  
    311311            $inline_script_tag = '';
    312312        }
     313
     314        /*
     315         * Prevent concatenation of scripts if the text domain is defined
     316         * to ensure the dependency order is respected.
     317         */
     318        $translations_stop_concat = ! empty( $obj->textdomain );
    313319
    314320        $translations = $this->print_translations( $handle, false );
     
    328334            $srce = apply_filters( 'script_loader_src', $src, $handle );
    329335
    330             if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations ) ) {
     336            if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) {
    331337                $this->do_concat = false;
    332338
Note: See TracChangeset for help on using the changeset viewer.