Changeset 53367
- Timestamp:
- 05/09/2022 12:01:48 AM (2 years ago)
- Location:
- branches/6.0
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0
- Property svn:mergeinfo changed
/trunk merged: 53360,53366
- Property svn:mergeinfo changed
-
branches/6.0/src/wp-includes/class.wp-scripts.php
r53283 r53367 311 311 $inline_script_tag = ''; 312 312 } 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 ); 313 319 314 320 $translations = $this->print_translations( $handle, false ); … … 328 334 $srce = apply_filters( 'script_loader_src', $src, $handle ); 329 335 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 ) ) { 331 337 $this->do_concat = false; 332 338 -
branches/6.0/tests/phpunit/tests/dependencies/scripts.php
r52937 r53367 1482 1482 ); 1483 1483 } 1484 1485 /** 1486 * @ticket 55628 1487 * @covers ::wp_set_script_translations 1488 */ 1489 public function test_wp_external_wp_i18n_print_order() { 1490 global $wp_scripts; 1491 1492 $wp_scripts->do_concat = true; 1493 $wp_scripts->default_dirs = array( '/default/' ); 1494 1495 // wp-i18n script in a non-default directory. 1496 wp_register_script( 'wp-i18n', '/plugins/wp-i18n.js', array(), null ); 1497 // Script in default dir that's going to be concatenated. 1498 wp_enqueue_script( 'jquery-core', '/default/jquery-core.js', array(), null ); 1499 // Script in default dir that depends on wp-i18n. 1500 wp_enqueue_script( 'common', '/default/common.js', array(), null ); 1501 wp_set_script_translations( 'common' ); 1502 1503 $print_scripts = get_echo( 1504 function() { 1505 wp_print_scripts(); 1506 _print_scripts(); 1507 } 1508 ); 1509 1510 // The non-default script should end concatenation and maintain order. 1511 $ver = get_bloginfo( 'version' ); 1512 $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$ver}'></script>\n"; 1513 $expected .= "<script type='text/javascript' src='/plugins/wp-i18n.js' id='wp-i18n-js'></script>\n"; 1514 $expected .= "<script type='text/javascript' src='/default/common.js' id='common-js'></script>\n"; 1515 1516 $this->assertSame( $expected, $print_scripts ); 1517 } 1484 1518 }
Note: See TracChangeset
for help on using the changeset viewer.