Changeset 61411
- Timestamp:
- 12/26/2025 01:14:22 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 36 edited
-
src/wp-activate.php (modified) (1 diff)
-
src/wp-admin/includes/ajax-actions.php (modified) (1 diff)
-
src/wp-admin/includes/plugin-install.php (modified) (1 diff)
-
src/wp-admin/includes/privacy-tools.php (modified) (1 diff)
-
src/wp-content/themes/twentyeleven/functions.php (modified) (1 diff)
-
src/wp-content/themes/twentyeleven/header.php (modified) (1 diff)
-
src/wp-content/themes/twentyfifteen/inc/custom-header.php (modified) (1 diff)
-
src/wp-content/themes/twentyfourteen/inc/custom-header.php (modified) (1 diff)
-
src/wp-content/themes/twentynineteen/functions.php (modified) (1 diff)
-
src/wp-content/themes/twentyseventeen/functions.php (modified) (1 diff)
-
src/wp-content/themes/twentyseventeen/inc/custom-header.php (modified) (1 diff)
-
src/wp-content/themes/twentysixteen/inc/customizer.php (modified) (1 diff)
-
src/wp-content/themes/twentyten/functions.php (modified) (1 diff)
-
src/wp-content/themes/twentyten/header.php (modified) (1 diff)
-
src/wp-content/themes/twentythirteen/inc/custom-header.php (modified) (1 diff)
-
src/wp-content/themes/twentytwelve/inc/custom-header.php (modified) (1 diff)
-
src/wp-includes/class-wp-styles.php (modified) (6 diffs)
-
src/wp-includes/deprecated.php (modified) (4 diffs)
-
src/wp-includes/fonts/class-wp-font-face.php (modified) (2 diffs)
-
src/wp-includes/functions.php (modified) (1 diff)
-
src/wp-includes/general-template.php (modified) (2 diffs)
-
src/wp-includes/media.php (modified) (1 diff)
-
src/wp-includes/ms-deprecated.php (modified) (1 diff)
-
src/wp-includes/script-loader.php (modified) (7 diffs)
-
src/wp-includes/theme-compat/header.php (modified) (1 diff)
-
src/wp-includes/theme.php (modified) (1 diff)
-
src/wp-includes/widgets/class-wp-widget-recent-comments.php (modified) (1 diff)
-
src/wp-login.php (modified) (1 diff)
-
src/wp-signup.php (modified) (1 diff)
-
tests/phpunit/tests/dependencies/scripts.php (modified) (140 diffs)
-
tests/phpunit/tests/dependencies/styles.php (modified) (13 diffs)
-
tests/phpunit/tests/dependencies/wpInlineScriptTag.php (modified) (1 diff)
-
tests/phpunit/tests/fonts/font-face/wpFontFace/generateAndPrint.php (modified) (1 diff)
-
tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php (modified) (2 diffs)
-
tests/phpunit/tests/fonts/font-face/wpPrintFontFacesFromStyleVariations.php (modified) (1 diff)
-
tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-activate.php
r60914 r61411 101 101 function wpmu_activate_stylesheet() { 102 102 ?> 103 <style type="text/css">103 <style> 104 104 .wp-activate-container { width: 90%; margin: 0 auto; } 105 105 .wp-activate-container form { margin-top: 2em; } -
trunk/src/wp-admin/includes/ajax-actions.php
r61312 r61411 3947 3947 3948 3948 foreach ( $styles as $style ) { 3949 $head .= '<link type="text/css"rel="stylesheet" href="' . $style . '">';3949 $head .= '<link rel="stylesheet" href="' . $style . '">'; 3950 3950 } 3951 3951 -
trunk/src/wp-admin/includes/plugin-install.php
r61353 r61411 607 607 $high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high']; 608 608 ?> 609 <style type="text/css">609 <style> 610 610 #plugin-information-title.with-banner { 611 611 background-image: url( <?php echo esc_url( $low ); ?> ); -
trunk/src/wp-admin/includes/privacy-tools.php
r60178 r61411 452 452 fwrite( $file, "<head>\n" ); 453 453 fwrite( $file, "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />\n" ); 454 fwrite( $file, "<style type='text/css'>");454 fwrite( $file, '<style>' ); 455 455 fwrite( $file, 'body { color: black; font-family: Arial, sans-serif; font-size: 11pt; margin: 15px auto; width: 860px; }' ); 456 456 fwrite( $file, 'table { background: #f0f0f0; border: 1px solid #ddd; margin-bottom: 20px; width: 100%; }' ); -
trunk/src/wp-content/themes/twentyeleven/functions.php
r61315 r61411 336 336 // If we get this far, we have custom styles. Let's do this. 337 337 ?> 338 <style type="text/css"id="twentyeleven-header-css">338 <style id="twentyeleven-header-css"> 339 339 <?php 340 340 // Has the text been hidden? -
trunk/src/wp-content/themes/twentyeleven/header.php
r61329 r61411 39 39 </title> 40 40 <link rel="profile" href="https://gmpg.org/xfn/11" /> 41 <link rel="stylesheet" type="text/css"media="all" href="<?php echo esc_url( get_stylesheet_uri() ); ?>?ver=20251202" />41 <link rel="stylesheet" media="all" href="<?php echo esc_url( get_stylesheet_uri() ); ?>?ver=20251202" /> 42 42 <link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>"> 43 43 <?php -
trunk/src/wp-content/themes/twentyfifteen/inc/custom-header.php
r60521 r61411 96 96 // If we get this far, we have custom styles. Let's do this. 97 97 ?> 98 <style type="text/css"id="twentyfifteen-header-css">98 <style id="twentyfifteen-header-css"> 99 99 <?php 100 100 // Short header for when there is no Custom Header and Header Text is hidden. -
trunk/src/wp-content/themes/twentyfourteen/inc/custom-header.php
r60519 r61411 70 70 // If we get this far, we have custom styles. 71 71 ?> 72 <style type="text/css"id="twentyfourteen-header-css">72 <style id="twentyfourteen-header-css"> 73 73 <?php 74 74 // Has the text been hidden? -
trunk/src/wp-content/themes/twentynineteen/functions.php
r61329 r61411 350 350 ?> 351 351 352 <style type="text/css"id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . absint( $primary_color ) . '"' : ''; ?>>352 <style id="custom-theme-colors" <?php echo is_customize_preview() ? 'data-hue="' . absint( $primary_color ) . '"' : ''; ?>> 353 353 <?php echo twentynineteen_custom_colors_css(); ?> 354 354 </style> -
trunk/src/wp-content/themes/twentyseventeen/functions.php
r61329 r61411 444 444 } 445 445 ?> 446 <style type="text/css"id="custom-theme-colors" <?php echo $customize_preview_data_hue; ?>>446 <style id="custom-theme-colors" <?php echo $customize_preview_data_hue; ?>> 447 447 <?php echo twentyseventeen_custom_colors_css(); ?> 448 448 </style> -
trunk/src/wp-content/themes/twentyseventeen/inc/custom-header.php
r60533 r61411 78 78 // If we get this far, we have custom styles. Let's do this. 79 79 ?> 80 <style id="twentyseventeen-custom-header-styles" type="text/css">80 <style id="twentyseventeen-custom-header-styles"> 81 81 <?php 82 82 // Has the text been hidden? -
trunk/src/wp-content/themes/twentysixteen/inc/customizer.php
r60965 r61411 91 91 // If the header text has been hidden. 92 92 ?> 93 <style type="text/css"id="twentysixteen-header-css">93 <style id="twentysixteen-header-css"> 94 94 .site-branding { 95 95 margin: 0 auto 0 0; -
trunk/src/wp-content/themes/twentyten/functions.php
r60509 r61411 276 276 function twentyten_admin_header_style() { 277 277 ?> 278 <style type="text/css"id="twentyten-admin-header-css">278 <style id="twentyten-admin-header-css"> 279 279 /* Shows the same border as on front end */ 280 280 #headimg { -
trunk/src/wp-content/themes/twentyten/header.php
r61329 r61411 40 40 </title> 41 41 <link rel="profile" href="https://gmpg.org/xfn/11" /> 42 <link rel="stylesheet" type="text/css"media="all" href="<?php echo esc_url( get_stylesheet_uri() ); ?>?ver=20251202" />42 <link rel="stylesheet" media="all" href="<?php echo esc_url( get_stylesheet_uri() ); ?>?ver=20251202" /> 43 43 <link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>"> 44 44 <?php -
trunk/src/wp-content/themes/twentythirteen/inc/custom-header.php
r61329 r61411 97 97 // If we get this far, we have custom styles. 98 98 ?> 99 <style type="text/css"id="twentythirteen-header-css">99 <style id="twentythirteen-header-css"> 100 100 <?php 101 101 if ( ! empty( $header_image ) ) : -
trunk/src/wp-content/themes/twentytwelve/inc/custom-header.php
r60514 r61411 78 78 // If we get this far, we have custom styles. 79 79 ?> 80 <style type="text/css"id="twentytwelve-header-css">80 <style id="twentytwelve-header-css"> 81 81 <?php 82 82 // Has the text been hidden? -
trunk/src/wp-includes/class-wp-styles.php
r61397 r61411 107 107 108 108 /** 109 * Holds a string which contains the type attribute for style tag.110 *111 * If the active theme does not declare HTML5 support for 'style',112 * then it initializes as `type='text/css'`.113 *114 * @since 5.3.0115 * @var string116 */117 private $type_attr = '';118 119 /**120 109 * Constructor. 121 110 * … … 123 112 */ 124 113 public function __construct() { 125 if (126 (127 function_exists( 'is_admin' ) &&128 ! is_admin()129 )130 &&131 (132 function_exists( 'current_theme_supports' ) &&133 ! current_theme_supports( 'html5', 'style' )134 )135 ) {136 $this->type_attr = " type='text/css'";137 }138 139 114 /** 140 115 * Fires when the WP_Styles instance is initialized. … … 185 160 if ( $inline_style ) { 186 161 $inline_style_tag = sprintf( 187 "<style id='%s-inline-css' %s>\n%s\n</style>\n",162 "<style id='%s-inline-css'>\n%s\n</style>\n", 188 163 esc_attr( $handle ), 189 $this->type_attr,190 164 $inline_style 191 165 ); … … 233 207 234 208 $tag = sprintf( 235 "<link rel='%s' id='%s-css'%s href='%s' %smedia='%s' />\n",209 "<link rel='%s' id='%s-css'%s href='%s' media='%s' />\n", 236 210 $rel, 237 211 esc_attr( $handle ), 238 212 $title ? sprintf( " title='%s'", esc_attr( $title ) ) : '', 239 213 $href, 240 $this->type_attr,241 214 esc_attr( $media ) 242 215 ); … … 265 238 266 239 $rtl_tag = sprintf( 267 "<link rel='%s' id='%s-rtl-css'%s href='%s' %smedia='%s' />\n",240 "<link rel='%s' id='%s-rtl-css'%s href='%s' media='%s' />\n", 268 241 $rel, 269 242 esc_attr( $handle ), 270 243 $title ? sprintf( " title='%s'", esc_attr( $title ) ) : '', 271 244 $rtl_href, 272 $this->type_attr,273 245 esc_attr( $media ) 274 246 ); … … 366 338 367 339 printf( 368 "<style id='%s-inline-css' %s>\n%s\n</style>\n",340 "<style id='%s-inline-css'>\n%s\n</style>\n", 369 341 esc_attr( $handle ), 370 $this->type_attr,371 342 $output 372 343 ); -
trunk/src/wp-includes/deprecated.php
r60910 r61411 5898 5898 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_embed_styles' ); 5899 5899 5900 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 5901 $suffix = SCRIPT_DEBUG ? '' : '.min'; 5900 $suffix = SCRIPT_DEBUG ? '' : '.min'; 5902 5901 ?> 5903 <style <?php echo $type_attr; ?>>5902 <style> 5904 5903 <?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?> 5905 5904 </style> … … 5923 5922 $printed = true; 5924 5923 5925 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';5926 5924 ?> 5927 <style <?php echo $type_attr; ?>>5925 <style> 5928 5926 img.wp-smiley, 5929 5927 img.emoji { … … 5950 5948 function wp_admin_bar_header() { 5951 5949 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_header_styles' ); 5952 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';5953 5950 ?> 5954 <style <?php echo $type_attr; ?>media="print">#wpadminbar { display:none; }</style>5951 <style media="print">#wpadminbar { display:none; }</style> 5955 5952 <?php 5956 5953 } … … 5964 5961 function _admin_bar_bump_cb() { 5965 5962 _deprecated_function( __FUNCTION__, '6.4.0', 'wp_enqueue_admin_bar_bump_styles' ); 5966 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';5967 5963 ?> 5968 <style <?php echo $type_attr; ?>media="screen">5964 <style media="screen"> 5969 5965 html { margin-top: 32px !important; } 5970 5966 @media screen and ( max-width: 782px ) { -
trunk/src/wp-includes/fonts/class-wp-font-face.php
r59259 r61411 63 63 64 64 /** 65 * Array of font-face style tag's attribute(s)66 * where the key is the attribute name and the67 * value is its value.68 *69 * @since 6.4.070 *71 * @var string[]72 */73 private $style_tag_attrs = array();74 75 /**76 * Creates and initializes an instance of WP_Font_Face.77 *78 * @since 6.4.079 */80 public function __construct() {81 if (82 function_exists( 'is_admin' ) && ! is_admin()83 &&84 function_exists( 'current_theme_supports' ) && ! current_theme_supports( 'html5', 'style' )85 ) {86 $this->style_tag_attrs = array( 'type' => 'text/css' );87 }88 }89 90 /**91 65 * Generates and prints the `@font-face` styles for the given fonts. 92 66 * … … 228 202 */ 229 203 private function get_style_element() { 230 $attributes = $this->generate_style_element_attributes(); 231 232 return "<style class='wp-fonts-local'{$attributes}>\n%s\n</style>\n"; 233 } 234 235 /** 236 * Gets the defined <style> element's attributes. 237 * 238 * @since 6.4.0 239 * 240 * @return string A string of attribute=value when defined, else, empty string. 241 */ 242 private function generate_style_element_attributes() { 243 $attributes = ''; 244 foreach ( $this->style_tag_attrs as $name => $value ) { 245 $attributes .= " {$name}='{$value}'"; 246 } 247 return $attributes; 204 return "<style class='wp-fonts-local'>\n%s\n</style>\n"; 248 205 } 249 206 -
trunk/src/wp-includes/functions.php
r61387 r61411 3922 3922 ?> 3923 3923 <title><?php echo $title; ?></title> 3924 <style type="text/css">3924 <style> 3925 3925 html { 3926 3926 background: #f1f1f1; -
trunk/src/wp-includes/general-template.php
r61326 r61411 5062 5062 5063 5063 $stylesheet_link = sprintf( 5064 "<link rel='stylesheet' href='%s' type='text/css'/>\n",5064 "<link rel='stylesheet' href='%s' />\n", 5065 5065 esc_url( wp_admin_css_uri( $file ) ) 5066 5066 ); … … 5081 5081 if ( function_exists( 'is_rtl' ) && is_rtl() ) { 5082 5082 $rtl_stylesheet_link = sprintf( 5083 "<link rel='stylesheet' href='%s' type='text/css'/>\n",5083 "<link rel='stylesheet' href='%s' />\n", 5084 5084 esc_url( wp_admin_css_uri( "$file-rtl" ) ) 5085 5085 ); -
trunk/src/wp-includes/media.php
r61387 r61411 2872 2872 */ 2873 2873 if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) { 2874 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';2875 2876 2874 $gallery_style = " 2877 <style {$type_attr}>2875 <style> 2878 2876 #{$selector} { 2879 2877 margin: auto; -
trunk/src/wp-includes/ms-deprecated.php
r57987 r61411 95 95 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 96 96 <title>Error!</title> 97 <style type="text/css">97 <style> 98 98 img { 99 99 border: 0; -
trunk/src/wp-includes/script-loader.php
r61388 r61411 2206 2206 } 2207 2207 2208 $concat = trim( $wp_scripts->concat, ', ' ); 2209 $type_attr = current_theme_supports( 'html5', 'script' ) ? '' : " type='text/javascript'"; 2208 $concat = trim( $wp_scripts->concat, ', ' ); 2210 2209 2211 2210 if ( $concat ) { 2212 2211 if ( ! empty( $wp_scripts->print_code ) ) { 2213 echo "\n<script {$type_attr}>\n";2212 echo "\n<script>\n"; 2214 2213 echo "/* <![CDATA[ */\n"; // Not needed in HTML 5. 2215 2214 echo $wp_scripts->print_code; … … 2227 2226 2228 2227 $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}" . $concatenated . '&ver=' . $wp_scripts->default_version; 2229 echo "<script {$type_attr}src='" . esc_attr( $src ) . "'></script>\n";2228 echo "<script src='" . esc_attr( $src ) . "'></script>\n"; 2230 2229 } 2231 2230 … … 2399 2398 } 2400 2399 2401 $concat = trim( $wp_styles->concat, ', ' ); 2402 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 2400 $concat = trim( $wp_styles->concat, ', ' ); 2403 2401 2404 2402 if ( $concat ) { … … 2415 2413 2416 2414 $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}" . $concatenated . '&ver=' . $ver; 2417 echo "<link rel='stylesheet' href='" . esc_attr( $href ) . "' {$type_attr}media='all' />\n";2415 echo "<link rel='stylesheet' href='" . esc_attr( $href ) . "' media='all' />\n"; 2418 2416 2419 2417 if ( ! empty( $wp_styles->print_code ) ) { 2420 echo "<style {$type_attr}>\n";2418 echo "<style>\n"; 2421 2419 echo $wp_styles->print_code; 2422 2420 echo sprintf( "\n/*# sourceURL=%s */", rawurlencode( $concat_source_url ) ); … … 2906 2904 */ 2907 2905 function wp_get_script_tag( $attributes ) { 2908 if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) {2909 // Keep the type attribute as the first for legacy reasons (it has always been this way in core).2910 $attributes = array_merge(2911 array( 'type' => 'text/javascript' ),2912 $attributes2913 );2914 }2915 2906 /** 2916 2907 * Filters attributes to be added to a script tag. … … 2954 2945 */ 2955 2946 function wp_get_inline_script_tag( $data, $attributes = array() ) { 2956 $is_html5 = current_theme_supports( 'html5', 'script' ) || is_admin();2957 if ( ! isset( $attributes['type'] ) && ! $is_html5 ) {2958 // Keep the type attribute as the first for legacy reasons (it has always been this way in core).2959 $attributes = array_merge(2960 array( 'type' => 'text/javascript' ),2961 $attributes2962 );2963 }2964 2965 2947 /* 2966 2948 * XHTML extracts the contents of the SCRIPT element and then the XML parser … … 2988 2970 */ 2989 2971 if ( 2990 ! $is_html5&&2972 ! current_theme_supports( 'html5', 'script' ) && 2991 2973 ( 2992 2974 ! isset( $attributes['type'] ) || -
trunk/src/wp-includes/theme-compat/header.php
r54881 r61411 24 24 <title><?php echo wp_get_document_title(); ?></title> 25 25 26 <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" type="text/css"media="screen" />26 <link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" media="screen" /> 27 27 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 28 28 29 29 <?php if ( file_exists( get_stylesheet_directory() . '/images/kubrickbgwide.jpg' ) ) { ?> 30 <style type="text/css"media="screen">30 <style media="screen"> 31 31 32 32 <?php -
trunk/src/wp-includes/theme.php
r60995 r61411 734 734 } 735 735 736 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';737 738 736 printf( 739 '<link rel="stylesheet" href="%s"%s media="screen" />', 740 $stylesheet, 741 $type_attr 737 '<link rel="stylesheet" href="%s" media="screen" />', 738 $stylesheet 742 739 ); 743 740 } -
trunk/src/wp-includes/widgets/class-wp-widget-recent-comments.php
r51967 r61411 56 56 } 57 57 58 $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"'; 59 60 printf( 61 '<style%s>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>', 62 $type_attr 63 ); 58 echo '<style>.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>'; 64 59 } 65 60 -
trunk/src/wp-login.php
r61387 r61411 177 177 178 178 ?> 179 <style type="text/css">html{background-color: transparent;}</style>179 <style>html{background-color: transparent;}</style> 180 180 <?php 181 181 -
trunk/src/wp-signup.php
r59960 r61411 64 64 function wpmu_signup_stylesheet() { 65 65 ?> 66 <style type="text/css">66 <style> 67 67 .mu_register { width: 90%; margin: 0 auto; } 68 68 .mu_register form { margin-top: 2em; } -
trunk/tests/phpunit/tests/dependencies/scripts.php
r61401 r61411 48 48 49 49 $this->wp_scripts_print_translations_output = <<<JS 50 <script type='text/javascript'id='__HANDLE__-js-translations'>50 <script id='__HANDLE__-js-translations'> 51 51 /* <![CDATA[ */ 52 52 ( function( domain, translations ) { … … 126 126 wp_enqueue_script( 'registered-no-qs-handle-null-version-enqueued-with-qs?arg1=foo&arg2=bar' ); 127 127 128 $expected = "<script type='text/javascript'src='http://example.com?ver={$wp_version}' id='no-deps-no-version-js'></script>\n";129 $expected .= "<script type='text/javascript'src='http://example.com?ver={$wp_version}' id='empty-deps-no-version-js'></script>\n";130 $expected .= "<script type='text/javascript'src='http://example.com?ver=1.2' id='empty-deps-version-js'></script>\n";131 $expected .= "<script type='text/javascript'src='http://example.com' id='empty-deps-null-version-js'></script>\n";132 $expected .= "<script type='text/javascript'src='https://example.com/test.js?ver=2.0&arg1=foo&arg2=bar' id='empty-deps-arg-in-handle-with-ver-js'></script>\n";133 $expected .= "<script type='text/javascript'src='https://example.com/test.js?arg1=foo&arg2=bar' id='empty-deps-arg-in-handle-without-ver-js'></script>\n";134 $expected .= "<script type='text/javascript'src='https://example.com/test.js?ver={$wp_version}&arg1=foo&arg2=bar' id='registered-no-qs-handle-null-version-enqueued-with-qs-js'></script>\n";128 $expected = "<script src='http://example.com?ver={$wp_version}' id='no-deps-no-version-js'></script>\n"; 129 $expected .= "<script src='http://example.com?ver={$wp_version}' id='empty-deps-no-version-js'></script>\n"; 130 $expected .= "<script src='http://example.com?ver=1.2' id='empty-deps-version-js'></script>\n"; 131 $expected .= "<script src='http://example.com' id='empty-deps-null-version-js'></script>\n"; 132 $expected .= "<script src='https://example.com/test.js?ver=2.0&arg1=foo&arg2=bar' id='empty-deps-arg-in-handle-with-ver-js'></script>\n"; 133 $expected .= "<script src='https://example.com/test.js?arg1=foo&arg2=bar' id='empty-deps-arg-in-handle-without-ver-js'></script>\n"; 134 $expected .= "<script src='https://example.com/test.js?ver={$wp_version}&arg1=foo&arg2=bar' id='registered-no-qs-handle-null-version-enqueued-with-qs-js'></script>\n"; 135 135 136 136 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 173 173 wp_add_inline_script( 'ms-isa-1', 'console.log(\'after one\');', 'after' ); 174 174 $output = get_echo( 'wp_print_scripts' ); 175 $expected = "<script type='text/javascript'src='http://example.org/ms-isa-1.js' id='ms-isa-1-js' data-wp-strategy='{$strategy}'></script>\n";175 $expected = "<script src='http://example.org/ms-isa-1.js' id='ms-isa-1-js' data-wp-strategy='{$strategy}'></script>\n"; 176 176 $expected .= wp_get_inline_script_tag( 177 177 "console.log('after one');\n//# sourceURL=ms-isa-1-js-after", … … 186 186 * Tests that inline scripts in the `after` position, attached to a blocking main script, are rendered as javascript. 187 187 * 188 * If a main script with a `blocking` strategy has an `after` inline script,189 * the inline script should be rendered as type='text/javascript'.190 *191 188 * @ticket 12009 192 189 * … … 201 198 $output = get_echo( 'wp_print_scripts' ); 202 199 203 $expected = "<script type='text/javascript'src='http://example.org/ms-insa-3.js' id='ms-insa-3-js'></script>\n";200 $expected = "<script src='http://example.org/ms-insa-3.js' id='ms-insa-3-js'></script>\n"; 204 201 $expected .= wp_get_inline_script_tag( 205 202 "console.log('after one');\n//# sourceURL=ms-insa-3-js-after", … … 242 239 ) 243 240 ); 244 $expected .= "<script type='text/javascript'src='http://example.org/ds-i1-1.js' id='ds-i1-1-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";245 $expected .= "<script type='text/javascript'src='http://example.org/ds-i1-2.js' id='ds-i1-2-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";246 $expected .= "<script type='text/javascript'src='http://example.org/ds-i1-3.js' id='ds-i1-3-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";241 $expected .= "<script src='http://example.org/ds-i1-1.js' id='ds-i1-1-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n"; 242 $expected .= "<script src='http://example.org/ds-i1-2.js' id='ds-i1-2-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n"; 243 $expected .= "<script src='http://example.org/ds-i1-3.js' id='ds-i1-3-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n"; 247 244 $expected .= wp_get_inline_script_tag( 248 245 "console.log('before last');\n//# sourceURL=ms-i1-1-js-before", 249 246 array( 250 'id' => 'ms-i1-1-js-before', 251 'type' => 'text/javascript', 247 'id' => 'ms-i1-1-js-before', 252 248 ) 253 249 ); 254 $expected .= "<script type='text/javascript'src='http://example.org/ms-i1-1.js' id='ms-i1-1-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n";250 $expected .= "<script src='http://example.org/ms-i1-1.js' id='ms-i1-1-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>\n"; 255 251 256 252 $this->assertEqualHTML( $expected, $output, '<body>', 'Inline scripts in the "before" position, that are attached to a deferred main script, are failing to print/execute.' ); … … 271 267 wp_enqueue_script( 'main-script-a1', '/main-script-a1.js', array(), null, array( 'strategy' => 'async' ) ); 272 268 $output = get_echo( 'wp_print_scripts' ); 273 $expected = "<script type='text/javascript'src='/main-script-a1.js' id='main-script-a1-js' async='async' data-wp-strategy='async'></script>\n";269 $expected = "<script src='/main-script-a1.js' id='main-script-a1-js' async='async' data-wp-strategy='async'></script>\n"; 274 270 $this->assertEqualHTML( $expected, $output, '<body>', 'Scripts enqueued with an async loading strategy are failing to have the async attribute applied to the script handle when being printed.' ); 275 271 } … … 293 289 wp_enqueue_script( 'main-script-a2', '/main-script-a2.js', array( 'dependency-script-a2' ), null, compact( 'strategy' ) ); 294 290 $output = get_echo( 'wp_print_scripts' ); 295 $expected = "<script id='dependency-script-a2-js' src='/dependency-script-a2.js' type='text/javascript'></script>\n";296 $expected .= "<script type='text/javascript'src='/main-script-a2.js' id='main-script-a2-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>";291 $expected = "<script id='dependency-script-a2-js' src='/dependency-script-a2.js'></script>\n"; 292 $expected .= "<script src='/main-script-a2.js' id='main-script-a2-js' {$strategy}='{$strategy}' data-wp-strategy='{$strategy}'></script>"; 297 293 $this->assertEqualHTML( $expected, $output, '<body>', 'Dependents of a blocking dependency are free to have any strategy.' ); 298 294 } … … 316 312 $output = get_echo( 'wp_print_scripts' ); 317 313 $expected = <<<JS 318 <script type='text/javascript'src='/main-script-a3.js' id='main-script-a3-js' data-wp-strategy='{$strategy}'></script>319 <script id="dependent-script-a3-js" src="/dependent-script-a3.js" type="text/javascript"></script>314 <script src='/main-script-a3.js' id='main-script-a3-js' data-wp-strategy='{$strategy}'></script> 315 <script id="dependent-script-a3-js" src="/dependent-script-a3.js"></script> 320 316 JS; 321 317 $this->assertEqualHTML( $expected, $output, '<body>', 'Blocking dependents must force delayed dependencies to become blocking.' ); … … 567 563 }, 568 564 'expected_markup' => <<<HTML 569 <script id="blocking-not-async-without-dependency-js-before" type="text/javascript">565 <script id="blocking-not-async-without-dependency-js-before"> 570 566 /* <![CDATA[ */ 571 567 scriptEventLog.push( "blocking-not-async-without-dependency: before inline" ) … … 573 569 /* ]]> */ 574 570 </script> 575 <script type='text/javascript'src='https://example.com/external.js?script_event_log=blocking-not-async-without-dependency%3A+script' id='blocking-not-async-without-dependency-js'></script>576 <script id="blocking-not-async-without-dependency-js-after" type="text/javascript">571 <script src='https://example.com/external.js?script_event_log=blocking-not-async-without-dependency%3A+script' id='blocking-not-async-without-dependency-js'></script> 572 <script id="blocking-not-async-without-dependency-js-after"> 577 573 /* <![CDATA[ */ 578 574 scriptEventLog.push( "blocking-not-async-without-dependency: after inline" ) … … 580 576 /* ]]> */ 581 577 </script> 582 <script id="async-with-blocking-dependency-js-before" type="text/javascript">578 <script id="async-with-blocking-dependency-js-before"> 583 579 /* <![CDATA[ */ 584 580 scriptEventLog.push( "async-with-blocking-dependency: before inline" ) … … 586 582 /* ]]> */ 587 583 </script> 588 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async-with-blocking-dependency%3A+script' id='async-with-blocking-dependency-js' data-wp-strategy='async'></script>589 <script id="async-with-blocking-dependency-js-after" type="text/javascript">584 <script src='https://example.com/external.js?script_event_log=async-with-blocking-dependency%3A+script' id='async-with-blocking-dependency-js' data-wp-strategy='async'></script> 585 <script id="async-with-blocking-dependency-js-after"> 590 586 /* <![CDATA[ */ 591 587 scriptEventLog.push( "async-with-blocking-dependency: after inline" ) … … 616 612 }, 617 613 'expected_markup' => <<<HTML 618 <script id="async-no-dependency-js-before" type="text/javascript">614 <script id="async-no-dependency-js-before"> 619 615 /* <![CDATA[ */ 620 616 scriptEventLog.push( "async-no-dependency: before inline" ) … … 622 618 /* ]]> */ 623 619 </script> 624 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async-no-dependency%3A+script' id='async-no-dependency-js' data-wp-strategy='async'></script>625 <script id="async-no-dependency-js-after" type="text/javascript">620 <script src='https://example.com/external.js?script_event_log=async-no-dependency%3A+script' id='async-no-dependency-js' data-wp-strategy='async'></script> 621 <script id="async-no-dependency-js-after"> 626 622 /* <![CDATA[ */ 627 623 scriptEventLog.push( "async-no-dependency: after inline" ) … … 629 625 /* ]]> */ 630 626 </script> 631 <script id="async-one-async-dependency-js-before" type="text/javascript">627 <script id="async-one-async-dependency-js-before"> 632 628 /* <![CDATA[ */ 633 629 scriptEventLog.push( "async-one-async-dependency: before inline" ) … … 635 631 /* ]]> */ 636 632 </script> 637 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async-one-async-dependency%3A+script' id='async-one-async-dependency-js' data-wp-strategy='async'></script>638 <script id="async-one-async-dependency-js-after" type="text/javascript">633 <script src='https://example.com/external.js?script_event_log=async-one-async-dependency%3A+script' id='async-one-async-dependency-js' data-wp-strategy='async'></script> 634 <script id="async-one-async-dependency-js-after"> 639 635 /* <![CDATA[ */ 640 636 scriptEventLog.push( "async-one-async-dependency: after inline" ) … … 642 638 /* ]]> */ 643 639 </script> 644 <script id="async-two-async-dependencies-js-before" type="text/javascript">640 <script id="async-two-async-dependencies-js-before"> 645 641 /* <![CDATA[ */ 646 642 scriptEventLog.push( "async-two-async-dependencies: before inline" ) … … 648 644 /* ]]> */ 649 645 </script> 650 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async-two-async-dependencies%3A+script' id='async-two-async-dependencies-js' data-wp-strategy='async'></script>651 <script id="async-two-async-dependencies-js-after" type="text/javascript">646 <script src='https://example.com/external.js?script_event_log=async-two-async-dependencies%3A+script' id='async-two-async-dependencies-js' data-wp-strategy='async'></script> 647 <script id="async-two-async-dependencies-js-after"> 652 648 /* <![CDATA[ */ 653 649 scriptEventLog.push( "async-two-async-dependencies: after inline" ) … … 670 666 }, 671 667 'expected_markup' => <<<HTML 672 <script id="async-with-blocking-dependent-js-before" type="text/javascript">668 <script id="async-with-blocking-dependent-js-before"> 673 669 /* <![CDATA[ */ 674 670 scriptEventLog.push( "async-with-blocking-dependent: before inline" ) … … 676 672 /* ]]> */ 677 673 </script> 678 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async-with-blocking-dependent%3A+script' id='async-with-blocking-dependent-js' data-wp-strategy='async'></script>679 <script id="async-with-blocking-dependent-js-after" type="text/javascript">674 <script src='https://example.com/external.js?script_event_log=async-with-blocking-dependent%3A+script' id='async-with-blocking-dependent-js' data-wp-strategy='async'></script> 675 <script id="async-with-blocking-dependent-js-after"> 680 676 /* <![CDATA[ */ 681 677 scriptEventLog.push( "async-with-blocking-dependent: after inline" ) … … 683 679 /* ]]> */ 684 680 </script> 685 <script id="blocking-dependent-of-async-js-before" type="text/javascript">681 <script id="blocking-dependent-of-async-js-before"> 686 682 /* <![CDATA[ */ 687 683 scriptEventLog.push( "blocking-dependent-of-async: before inline" ) … … 689 685 /* ]]> */ 690 686 </script> 691 <script type='text/javascript'src='https://example.com/external.js?script_event_log=blocking-dependent-of-async%3A+script' id='blocking-dependent-of-async-js'></script>692 <script id="blocking-dependent-of-async-js-after" type="text/javascript">687 <script src='https://example.com/external.js?script_event_log=blocking-dependent-of-async%3A+script' id='blocking-dependent-of-async-js'></script> 688 <script id="blocking-dependent-of-async-js-after"> 693 689 /* <![CDATA[ */ 694 690 scriptEventLog.push( "blocking-dependent-of-async: after inline" ) … … 711 707 }, 712 708 'expected_markup' => <<<HTML 713 <script id="async-with-defer-dependent-js-before" type="text/javascript">709 <script id="async-with-defer-dependent-js-before"> 714 710 /* <![CDATA[ */ 715 711 scriptEventLog.push( "async-with-defer-dependent: before inline" ) … … 717 713 /* ]]> */ 718 714 </script> 719 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async-with-defer-dependent%3A+script' id='async-with-defer-dependent-js' data-wp-strategy='async'></script>720 <script id="async-with-defer-dependent-js-after" type="text/javascript">715 <script src='https://example.com/external.js?script_event_log=async-with-defer-dependent%3A+script' id='async-with-defer-dependent-js' data-wp-strategy='async'></script> 716 <script id="async-with-defer-dependent-js-after"> 721 717 /* <![CDATA[ */ 722 718 scriptEventLog.push( "async-with-defer-dependent: after inline" ) … … 724 720 /* ]]> */ 725 721 </script> 726 <script id="defer-dependent-of-async-js-before" type="text/javascript">722 <script id="defer-dependent-of-async-js-before"> 727 723 /* <![CDATA[ */ 728 724 scriptEventLog.push( "defer-dependent-of-async: before inline" ) … … 730 726 /* ]]> */ 731 727 </script> 732 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-async%3A+script' id='defer-dependent-of-async-js' data-wp-strategy='defer'></script>733 <script id="defer-dependent-of-async-js-after" type="text/javascript">728 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-async%3A+script' id='defer-dependent-of-async-js' data-wp-strategy='defer'></script> 729 <script id="defer-dependent-of-async-js-after"> 734 730 /* <![CDATA[ */ 735 731 scriptEventLog.push( "defer-dependent-of-async: after inline" ) … … 755 751 }, 756 752 'expected_markup' => <<<HTML 757 <script id="blocking-bundle-of-none-js-before" type="text/javascript">753 <script id="blocking-bundle-of-none-js-before"> 758 754 /* <![CDATA[ */ 759 755 scriptEventLog.push( "blocking-bundle-of-none: before inline" ) … … 761 757 /* ]]> */ 762 758 </script> 763 <script id="blocking-bundle-of-none-js-after" type="text/javascript">759 <script id="blocking-bundle-of-none-js-after"> 764 760 /* <![CDATA[ */ 765 761 scriptEventLog.push( "blocking-bundle-of-none: after inline" ) … … 767 763 /* ]]> */ 768 764 </script> 769 <script id="defer-dependent-of-blocking-bundle-of-none-js-before" type="text/javascript">765 <script id="defer-dependent-of-blocking-bundle-of-none-js-before"> 770 766 /* <![CDATA[ */ 771 767 scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-none: before inline" ) … … 773 769 /* ]]> */ 774 770 </script> 775 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-bundle-of-none%3A+script' id='defer-dependent-of-blocking-bundle-of-none-js' data-wp-strategy='defer'></script>776 <script id="defer-dependent-of-blocking-bundle-of-none-js-after" type="text/javascript">771 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-bundle-of-none%3A+script' id='defer-dependent-of-blocking-bundle-of-none-js' data-wp-strategy='defer'></script> 772 <script id="defer-dependent-of-blocking-bundle-of-none-js-after"> 777 773 /* <![CDATA[ */ 778 774 scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-none: after inline" ) … … 801 797 }, 802 798 'expected_markup' => <<<HTML 803 <script id="blocking-bundle-member-one-js-before" type="text/javascript">799 <script id="blocking-bundle-member-one-js-before"> 804 800 /* <![CDATA[ */ 805 801 scriptEventLog.push( "blocking-bundle-member-one: before inline" ) … … 807 803 /* ]]> */ 808 804 </script> 809 <script type='text/javascript'src='https://example.com/external.js?script_event_log=blocking-bundle-member-one%3A+script' id='blocking-bundle-member-one-js'></script>810 <script id="blocking-bundle-member-one-js-after" type="text/javascript">805 <script src='https://example.com/external.js?script_event_log=blocking-bundle-member-one%3A+script' id='blocking-bundle-member-one-js'></script> 806 <script id="blocking-bundle-member-one-js-after"> 811 807 /* <![CDATA[ */ 812 808 scriptEventLog.push( "blocking-bundle-member-one: after inline" ) … … 814 810 /* ]]> */ 815 811 </script> 816 <script id="blocking-bundle-member-two-js-before" type="text/javascript">812 <script id="blocking-bundle-member-two-js-before"> 817 813 /* <![CDATA[ */ 818 814 scriptEventLog.push( "blocking-bundle-member-two: before inline" ) … … 820 816 /* ]]> */ 821 817 </script> 822 <script type='text/javascript'src='https://example.com/external.js?script_event_log=blocking-bundle-member-two%3A+script' id='blocking-bundle-member-two-js'></script>823 <script id="blocking-bundle-member-two-js-after" type="text/javascript">818 <script src='https://example.com/external.js?script_event_log=blocking-bundle-member-two%3A+script' id='blocking-bundle-member-two-js'></script> 819 <script id="blocking-bundle-member-two-js-after"> 824 820 /* <![CDATA[ */ 825 821 scriptEventLog.push( "blocking-bundle-member-two: after inline" ) … … 827 823 /* ]]> */ 828 824 </script> 829 <script id="defer-dependent-of-blocking-bundle-of-two-js-before" type="text/javascript">825 <script id="defer-dependent-of-blocking-bundle-of-two-js-before"> 830 826 /* <![CDATA[ */ 831 827 scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-two: before inline" ) … … 833 829 /* ]]> */ 834 830 </script> 835 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-bundle-of-two%3A+script' id='defer-dependent-of-blocking-bundle-of-two-js' data-wp-strategy='defer'></script>836 <script id="defer-dependent-of-blocking-bundle-of-two-js-after" type="text/javascript">831 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-bundle-of-two%3A+script' id='defer-dependent-of-blocking-bundle-of-two-js' data-wp-strategy='defer'></script> 832 <script id="defer-dependent-of-blocking-bundle-of-two-js-after"> 837 833 /* <![CDATA[ */ 838 834 scriptEventLog.push( "defer-dependent-of-blocking-bundle-of-two: after inline" ) … … 860 856 }, 861 857 'expected_markup' => <<<HTML 862 <script id="defer-bundle-of-none-js-before" type="text/javascript">858 <script id="defer-bundle-of-none-js-before"> 863 859 /* <![CDATA[ */ 864 860 scriptEventLog.push( "defer-bundle-of-none: before inline" ) … … 866 862 /* ]]> */ 867 863 </script> 868 <script id="defer-bundle-of-none-js-after" type="text/javascript">864 <script id="defer-bundle-of-none-js-after"> 869 865 /* <![CDATA[ */ 870 866 scriptEventLog.push( "defer-bundle-of-none: after inline" ) … … 872 868 /* ]]> */ 873 869 </script> 874 <script id="defer-dependent-of-defer-bundle-of-none-js-before" type="text/javascript">870 <script id="defer-dependent-of-defer-bundle-of-none-js-before"> 875 871 /* <![CDATA[ */ 876 872 scriptEventLog.push( "defer-dependent-of-defer-bundle-of-none: before inline" ) … … 878 874 /* ]]> */ 879 875 </script> 880 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-defer-bundle-of-none%3A+script' id='defer-dependent-of-defer-bundle-of-none-js' data-wp-strategy='defer'></script>881 <script id="defer-dependent-of-defer-bundle-of-none-js-after" type="text/javascript">876 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-defer-bundle-of-none%3A+script' id='defer-dependent-of-defer-bundle-of-none-js' data-wp-strategy='defer'></script> 877 <script id="defer-dependent-of-defer-bundle-of-none-js-after"> 882 878 /* <![CDATA[ */ 883 879 scriptEventLog.push( "defer-dependent-of-defer-bundle-of-none: after inline" ) … … 903 899 }, 904 900 'expected_markup' => <<<HTML 905 <script id="blocking-dependency-with-defer-following-dependency-js-before" type="text/javascript">901 <script id="blocking-dependency-with-defer-following-dependency-js-before"> 906 902 /* <![CDATA[ */ 907 903 scriptEventLog.push( "blocking-dependency-with-defer-following-dependency: before inline" ) … … 909 905 /* ]]> */ 910 906 </script> 911 <script type='text/javascript'src='https://example.com/external.js?script_event_log=blocking-dependency-with-defer-following-dependency%3A+script' id='blocking-dependency-with-defer-following-dependency-js'></script>912 <script id="blocking-dependency-with-defer-following-dependency-js-after" type="text/javascript">907 <script src='https://example.com/external.js?script_event_log=blocking-dependency-with-defer-following-dependency%3A+script' id='blocking-dependency-with-defer-following-dependency-js'></script> 908 <script id="blocking-dependency-with-defer-following-dependency-js-after"> 913 909 /* <![CDATA[ */ 914 910 scriptEventLog.push( "blocking-dependency-with-defer-following-dependency: after inline" ) … … 916 912 /* ]]> */ 917 913 </script> 918 <script id="defer-dependency-with-blocking-preceding-dependency-js-before" type="text/javascript">914 <script id="defer-dependency-with-blocking-preceding-dependency-js-before"> 919 915 /* <![CDATA[ */ 920 916 scriptEventLog.push( "defer-dependency-with-blocking-preceding-dependency: before inline" ) … … 922 918 /* ]]> */ 923 919 </script> 924 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependency-with-blocking-preceding-dependency%3A+script' id='defer-dependency-with-blocking-preceding-dependency-js' data-wp-strategy='defer'></script>925 <script id="defer-dependency-with-blocking-preceding-dependency-js-after" type="text/javascript">920 <script src='https://example.com/external.js?script_event_log=defer-dependency-with-blocking-preceding-dependency%3A+script' id='defer-dependency-with-blocking-preceding-dependency-js' data-wp-strategy='defer'></script> 921 <script id="defer-dependency-with-blocking-preceding-dependency-js-after"> 926 922 /* <![CDATA[ */ 927 923 scriptEventLog.push( "defer-dependency-with-blocking-preceding-dependency: after inline" ) … … 929 925 /* ]]> */ 930 926 </script> 931 <script id="defer-dependent-of-blocking-and-defer-dependencies-js-before" type="text/javascript">927 <script id="defer-dependent-of-blocking-and-defer-dependencies-js-before"> 932 928 /* <![CDATA[ */ 933 929 scriptEventLog.push( "defer-dependent-of-blocking-and-defer-dependencies: before inline" ) … … 935 931 /* ]]> */ 936 932 </script> 937 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-and-defer-dependencies%3A+script' id='defer-dependent-of-blocking-and-defer-dependencies-js' data-wp-strategy='defer'></script>938 <script id="defer-dependent-of-blocking-and-defer-dependencies-js-after" type="text/javascript">933 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-blocking-and-defer-dependencies%3A+script' id='defer-dependent-of-blocking-and-defer-dependencies-js' data-wp-strategy='defer'></script> 934 <script id="defer-dependent-of-blocking-and-defer-dependencies-js-after"> 939 935 /* <![CDATA[ */ 940 936 scriptEventLog.push( "defer-dependent-of-blocking-and-defer-dependencies: after inline" ) … … 960 956 }, 961 957 'expected_markup' => <<<HTML 962 <script id="defer-dependency-with-blocking-following-dependency-js-before" type="text/javascript">958 <script id="defer-dependency-with-blocking-following-dependency-js-before"> 963 959 /* <![CDATA[ */ 964 960 scriptEventLog.push( "defer-dependency-with-blocking-following-dependency: before inline" ) … … 966 962 /* ]]> */ 967 963 </script> 968 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependency-with-blocking-following-dependency%3A+script' id='defer-dependency-with-blocking-following-dependency-js' data-wp-strategy='defer'></script>969 <script id="defer-dependency-with-blocking-following-dependency-js-after" type="text/javascript">964 <script src='https://example.com/external.js?script_event_log=defer-dependency-with-blocking-following-dependency%3A+script' id='defer-dependency-with-blocking-following-dependency-js' data-wp-strategy='defer'></script> 965 <script id="defer-dependency-with-blocking-following-dependency-js-after"> 970 966 /* <![CDATA[ */ 971 967 scriptEventLog.push( "defer-dependency-with-blocking-following-dependency: after inline" ) … … 973 969 /* ]]> */ 974 970 </script> 975 <script id="blocking-dependency-with-defer-preceding-dependency-js-before" type="text/javascript">971 <script id="blocking-dependency-with-defer-preceding-dependency-js-before"> 976 972 /* <![CDATA[ */ 977 973 scriptEventLog.push( "blocking-dependency-with-defer-preceding-dependency: before inline" ) … … 979 975 /* ]]> */ 980 976 </script> 981 <script type='text/javascript'src='https://example.com/external.js?script_event_log=blocking-dependency-with-defer-preceding-dependency%3A+script' id='blocking-dependency-with-defer-preceding-dependency-js'></script>982 <script id="blocking-dependency-with-defer-preceding-dependency-js-after" type="text/javascript">977 <script src='https://example.com/external.js?script_event_log=blocking-dependency-with-defer-preceding-dependency%3A+script' id='blocking-dependency-with-defer-preceding-dependency-js'></script> 978 <script id="blocking-dependency-with-defer-preceding-dependency-js-after"> 983 979 /* <![CDATA[ */ 984 980 scriptEventLog.push( "blocking-dependency-with-defer-preceding-dependency: after inline" ) … … 986 982 /* ]]> */ 987 983 </script> 988 <script id="defer-dependent-of-defer-and-blocking-dependencies-js-before" type="text/javascript">984 <script id="defer-dependent-of-defer-and-blocking-dependencies-js-before"> 989 985 /* <![CDATA[ */ 990 986 scriptEventLog.push( "defer-dependent-of-defer-and-blocking-dependencies: before inline" ) … … 992 988 /* ]]> */ 993 989 </script> 994 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-defer-and-blocking-dependencies%3A+script' id='defer-dependent-of-defer-and-blocking-dependencies-js' data-wp-strategy='defer'></script>995 <script id="defer-dependent-of-defer-and-blocking-dependencies-js-after" type="text/javascript">990 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-defer-and-blocking-dependencies%3A+script' id='defer-dependent-of-defer-and-blocking-dependencies-js' data-wp-strategy='defer'></script> 991 <script id="defer-dependent-of-defer-and-blocking-dependencies-js-after"> 996 992 /* <![CDATA[ */ 997 993 scriptEventLog.push( "defer-dependent-of-defer-and-blocking-dependencies: after inline" ) … … 1014 1010 }, 1015 1011 'expected_markup' => <<<HTML 1016 <script id="defer-with-async-dependent-js-before" type="text/javascript">1012 <script id="defer-with-async-dependent-js-before"> 1017 1013 /* <![CDATA[ */ 1018 1014 scriptEventLog.push( "defer-with-async-dependent: before inline" ) … … 1020 1016 /* ]]> */ 1021 1017 </script> 1022 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-with-async-dependent%3A+script' id='defer-with-async-dependent-js' data-wp-strategy='defer'></script>1023 <script id="defer-with-async-dependent-js-after" type="text/javascript">1018 <script src='https://example.com/external.js?script_event_log=defer-with-async-dependent%3A+script' id='defer-with-async-dependent-js' data-wp-strategy='defer'></script> 1019 <script id="defer-with-async-dependent-js-after"> 1024 1020 /* <![CDATA[ */ 1025 1021 scriptEventLog.push( "defer-with-async-dependent: after inline" ) … … 1027 1023 /* ]]> */ 1028 1024 </script> 1029 <script id="async-dependent-of-defer-js-before" type="text/javascript">1025 <script id="async-dependent-of-defer-js-before"> 1030 1026 /* <![CDATA[ */ 1031 1027 scriptEventLog.push( "async-dependent-of-defer: before inline" ) … … 1033 1029 /* ]]> */ 1034 1030 </script> 1035 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async-dependent-of-defer%3A+script' id='async-dependent-of-defer-js' data-wp-strategy='async'></script>1036 <script id="async-dependent-of-defer-js-after" type="text/javascript">1031 <script src='https://example.com/external.js?script_event_log=async-dependent-of-defer%3A+script' id='async-dependent-of-defer-js' data-wp-strategy='async'></script> 1032 <script id="async-dependent-of-defer-js-after"> 1037 1033 /* <![CDATA[ */ 1038 1034 scriptEventLog.push( "async-dependent-of-defer: after inline" ) … … 1051 1047 }, 1052 1048 'expected_markup' => <<<HTML 1053 <script id="defer-with-before-inline-js-before" type="text/javascript">1049 <script id="defer-with-before-inline-js-before"> 1054 1050 /* <![CDATA[ */ 1055 1051 scriptEventLog.push( "defer-with-before-inline: before inline" ) … … 1057 1053 /* ]]> */ 1058 1054 </script> 1059 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-with-before-inline%3A+script' id='defer-with-before-inline-js' defer='defer' data-wp-strategy='defer'></script>1055 <script src='https://example.com/external.js?script_event_log=defer-with-before-inline%3A+script' id='defer-with-before-inline-js' defer='defer' data-wp-strategy='defer'></script> 1060 1056 HTML 1061 1057 , … … 1069 1065 }, 1070 1066 'expected_markup' => <<<HTML 1071 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-with-after-inline%3A+script' id='defer-with-after-inline-js' data-wp-strategy='defer'></script>1072 <script id="defer-with-after-inline-js-after" type="text/javascript">1067 <script src='https://example.com/external.js?script_event_log=defer-with-after-inline%3A+script' id='defer-with-after-inline-js' data-wp-strategy='defer'></script> 1068 <script id="defer-with-after-inline-js-after"> 1073 1069 /* <![CDATA[ */ 1074 1070 scriptEventLog.push( "defer-with-after-inline: after inline" ) … … 1090 1086 }, 1091 1087 'expected_markup' => <<<HTML 1092 <script type='text/javascript'src='http://$wp_tests_domain/wp-includes/js/jquery/jquery.js' id='jquery-core-js' defer='defer' data-wp-strategy='defer'></script>1093 <script type='text/javascript'src='http://$wp_tests_domain/wp-includes/js/jquery/jquery-migrate.js' id='jquery-migrate-js' defer='defer' data-wp-strategy='defer'></script>1094 <script type='text/javascript'src='https://example.com/theme-functions.js' id='theme-functions-js' defer='defer' data-wp-strategy='defer'></script>1088 <script src='http://$wp_tests_domain/wp-includes/js/jquery/jquery.js' id='jquery-core-js' defer='defer' data-wp-strategy='defer'></script> 1089 <script src='http://$wp_tests_domain/wp-includes/js/jquery/jquery-migrate.js' id='jquery-migrate-js' defer='defer' data-wp-strategy='defer'></script> 1090 <script src='https://example.com/theme-functions.js' id='theme-functions-js' defer='defer' data-wp-strategy='defer'></script> 1095 1091 HTML 1096 1092 , … … 1115 1111 }, 1116 1112 'expected_markup' => <<<HTML 1117 <script type='text/javascript'src='https://example.com/external.js?script_event_log=inner-bundle-member-one%3A+script' id='inner-bundle-member-one-js' data-wp-strategy='defer'></script>1118 <script type='text/javascript'src='https://example.com/external.js?script_event_log=inner-bundle-member-two%3A+script' id='inner-bundle-member-two-js' data-wp-strategy='defer'></script>1119 <script type='text/javascript'src='https://example.com/external.js?script_event_log=outer-bundle-leaf-member%3A+script' id='outer-bundle-leaf-member-js'></script>1120 <script id="defer-dependent-of-nested-aliases-js-before" type="text/javascript">1113 <script src='https://example.com/external.js?script_event_log=inner-bundle-member-one%3A+script' id='inner-bundle-member-one-js' data-wp-strategy='defer'></script> 1114 <script src='https://example.com/external.js?script_event_log=inner-bundle-member-two%3A+script' id='inner-bundle-member-two-js' data-wp-strategy='defer'></script> 1115 <script src='https://example.com/external.js?script_event_log=outer-bundle-leaf-member%3A+script' id='outer-bundle-leaf-member-js'></script> 1116 <script id="defer-dependent-of-nested-aliases-js-before"> 1121 1117 /* <![CDATA[ */ 1122 1118 scriptEventLog.push( "defer-dependent-of-nested-aliases: before inline" ) … … 1124 1120 /* ]]> */ 1125 1121 </script> 1126 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-nested-aliases%3A+script' id='defer-dependent-of-nested-aliases-js' data-wp-strategy='defer'></script>1127 <script id="defer-dependent-of-nested-aliases-js-after" type="text/javascript">1122 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-nested-aliases%3A+script' id='defer-dependent-of-nested-aliases-js' data-wp-strategy='defer'></script> 1123 <script id="defer-dependent-of-nested-aliases-js-after"> 1128 1124 /* <![CDATA[ */ 1129 1125 scriptEventLog.push( "defer-dependent-of-nested-aliases: after inline" ) … … 1148 1144 }, 1149 1145 'expected_markup' => <<<HTML 1150 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async1%3A+script' id='async1-js' defer='defer' data-wp-strategy='async'></script>1151 <script type='text/javascript'src='https://example.com/external.js?script_event_log=async2%3A+script' id='async2-js' defer='defer' data-wp-strategy='async'></script>1152 <script type='text/javascript'src='https://example.com/external.js?script_event_log=defer-dependent-of-async-aliases%3A+script' id='defer-dependent-of-async-aliases-js' defer='defer' data-wp-strategy='defer'></script>1146 <script src='https://example.com/external.js?script_event_log=async1%3A+script' id='async1-js' defer='defer' data-wp-strategy='async'></script> 1147 <script src='https://example.com/external.js?script_event_log=async2%3A+script' id='async2-js' defer='defer' data-wp-strategy='async'></script> 1148 <script src='https://example.com/external.js?script_event_log=defer-dependent-of-async-aliases%3A+script' id='defer-dependent-of-async-aliases-js' defer='defer' data-wp-strategy='defer'></script> 1153 1149 HTML 1154 1150 , … … 1281 1277 // Note: All of these scripts have fetchpriority=high because the leaf dependent script has that fetch priority. 1282 1278 $output = get_echo( 'wp_print_scripts' ); 1283 $expected = "<script type='text/javascript'src='/main-script-d4.js' id='main-script-d4-js' defer='defer' data-wp-strategy='defer' fetchpriority='high' data-wp-fetchpriority='auto'></script>\n";1284 $expected .= "<script type='text/javascript'src='/dependent-script-d4-1.js' id='dependent-script-d4-1-js' defer='defer' data-wp-strategy='defer' fetchpriority='high' data-wp-fetchpriority='auto'></script>\n";1285 $expected .= "<script type='text/javascript'src='/dependent-script-d4-2.js' id='dependent-script-d4-2-js' defer='defer' data-wp-strategy='async' fetchpriority='high' data-wp-fetchpriority='low'></script>\n";1286 $expected .= "<script type='text/javascript'src='/dependent-script-d4-3.js' id='dependent-script-d4-3-js' defer='defer' data-wp-strategy='defer' fetchpriority='high'></script>\n";1279 $expected = "<script src='/main-script-d4.js' id='main-script-d4-js' defer='defer' data-wp-strategy='defer' fetchpriority='high' data-wp-fetchpriority='auto'></script>\n"; 1280 $expected .= "<script src='/dependent-script-d4-1.js' id='dependent-script-d4-1-js' defer='defer' data-wp-strategy='defer' fetchpriority='high' data-wp-fetchpriority='auto'></script>\n"; 1281 $expected .= "<script src='/dependent-script-d4-2.js' id='dependent-script-d4-2-js' defer='defer' data-wp-strategy='async' fetchpriority='high' data-wp-fetchpriority='low'></script>\n"; 1282 $expected .= "<script src='/dependent-script-d4-3.js' id='dependent-script-d4-3-js' defer='defer' data-wp-strategy='defer' fetchpriority='high'></script>\n"; 1287 1283 1288 1284 $this->assertEqualHTML( $expected, $output, '<body>', 'Scripts registered as defer but that have dependents that are async are expected to have said dependents deferred.' ); … … 1400 1396 'enqueue_bajo' => array( 1401 1397 'enqueues' => array( 'bajo' ), 1402 'expected' => '<script fetchpriority="low" id="bajo-js" src="/bajo.js" type="text/javascript"></script>',1398 'expected' => '<script fetchpriority="low" id="bajo-js" src="/bajo.js"></script>', 1403 1399 ), 1404 1400 'enqueue_auto' => array( 1405 1401 'enqueues' => array( 'auto' ), 1406 1402 'expected' => ' 1407 <script type="text/javascript"src="/bajo.js" id="bajo-js" data-wp-fetchpriority="low"></script>1408 <script type="text/javascript"src="/auto.js" id="auto-js"></script>1403 <script src="/bajo.js" id="bajo-js" data-wp-fetchpriority="low"></script> 1404 <script src="/auto.js" id="auto-js"></script> 1409 1405 ', 1410 1406 ), … … 1412 1408 'enqueues' => array( 'alto' ), 1413 1409 'expected' => ' 1414 <script type="text/javascript"src="/bajo.js" id="bajo-js" fetchpriority="high" data-wp-fetchpriority="low"></script>1415 <script type="text/javascript"src="/auto.js" id="auto-js" fetchpriority="high" data-wp-fetchpriority="auto"></script>1416 <script type="text/javascript"src="/alto.js" id="alto-js" fetchpriority="high"></script>1410 <script src="/bajo.js" id="bajo-js" fetchpriority="high" data-wp-fetchpriority="low"></script> 1411 <script src="/auto.js" id="auto-js" fetchpriority="high" data-wp-fetchpriority="auto"></script> 1412 <script src="/alto.js" id="alto-js" fetchpriority="high"></script> 1417 1413 ', 1418 1414 ), … … 1470 1466 $actual = get_echo( 'wp_print_scripts' ); 1471 1467 $expected = ' 1472 <script type="text/javascript"src="/z.js" id="z-js" fetchpriority="high" data-wp-fetchpriority="auto"></script>1473 <script type="text/javascript"src="/d.js" id="d-js" fetchpriority="high"></script>1474 <script type="text/javascript"src="/e.js" id="e-js"></script>1475 <script type="text/javascript"src="/c.js" id="c-js"></script>1476 <script type="text/javascript"src="/b.js" id="b-js"></script>1477 <script type="text/javascript"src="/a.js" id="a-js" fetchpriority="low"></script>1478 <script type="text/javascript"src="/y.js" id="y-js" fetchpriority="high" data-wp-fetchpriority="auto"></script>1479 <script type="text/javascript"src="/x.js" id="x-js" fetchpriority="high"></script>1468 <script src="/z.js" id="z-js" fetchpriority="high" data-wp-fetchpriority="auto"></script> 1469 <script src="/d.js" id="d-js" fetchpriority="high"></script> 1470 <script src="/e.js" id="e-js"></script> 1471 <script src="/c.js" id="c-js"></script> 1472 <script src="/b.js" id="b-js"></script> 1473 <script src="/a.js" id="a-js" fetchpriority="low"></script> 1474 <script src="/y.js" id="y-js" fetchpriority="high" data-wp-fetchpriority="auto"></script> 1475 <script src="/x.js" id="x-js" fetchpriority="high"></script> 1480 1476 '; 1481 1477 $this->assertEqualHTML( $expected, $actual, '<body>', "Snapshot:\n$actual" ); … … 1534 1530 $actual = $this->normalize_markup_for_snapshot( get_echo( array( $wp_scripts, 'print_scripts' ) ) ); 1535 1531 $this->assertEqualHTML( 1536 '<script type="text/javascript"src="/wp-includes/js/comment-reply.js" id="comment-reply-js" async="async" data-wp-strategy="async" fetchpriority="low"></script>',1532 '<script src="/wp-includes/js/comment-reply.js" id="comment-reply-js" async="async" data-wp-strategy="async" fetchpriority="low"></script>', 1537 1533 $actual, 1538 1534 '<body>', … … 1571 1567 $this->assertEqualHTML( 1572 1568 sprintf( 1573 '<script type="text/javascript"src="%s" id="comment-reply-js" async="async" data-wp-strategy="async" fetchpriority="low"></script>',1569 '<script src="%s" id="comment-reply-js" async="async" data-wp-strategy="async" fetchpriority="low"></script>', 1574 1570 includes_url( 'js/comment-reply.js' ) 1575 1571 ), … … 1611 1607 wp_enqueue_script( 'dependent-script-d4-3', '/dependent-script-d4-3.js', array( 'dependent-script-d4-2' ), null, array( 'strategy' => 'defer' ) ); 1612 1608 $output = get_echo( 'wp_print_scripts' ); 1613 $expected = str_replace( "'", '"', "<script type='text/javascript'src='/main-script-d4.js' id='main-script-d4-js' data-wp-strategy='defer'></script>\n" );1609 $expected = str_replace( "'", '"', "<script src='/main-script-d4.js' id='main-script-d4-js' data-wp-strategy='defer'></script>\n" ); 1614 1610 $this->assertStringContainsString( $expected, $output, 'Scripts registered as defer but that have all dependents with no strategy, should become blocking (no strategy).' ); 1615 1611 } … … 1628 1624 wp_enqueue_script( 'main-script-b1', '/main-script-b1.js', array(), null ); 1629 1625 $output = get_echo( 'wp_print_scripts' ); 1630 $expected = "<script type='text/javascript'src='/main-script-b1.js' id='main-script-b1-js'></script>\n";1626 $expected = "<script src='/main-script-b1.js' id='main-script-b1-js'></script>\n"; 1631 1627 $this->assertEqualHTML( $expected, $output, '<body>', 'Scripts registered with a "blocking" strategy, and who have no dependencies, should have no loading strategy attributes printed.' ); 1632 1628 … … 1634 1630 wp_enqueue_script( 'main-script-b2', '/main-script-b2.js', array(), null, array() ); 1635 1631 $output = get_echo( 'wp_print_scripts' ); 1636 $expected = "<script type='text/javascript'src='/main-script-b2.js' id='main-script-b2-js'></script>\n";1632 $expected = "<script src='/main-script-b2.js' id='main-script-b2-js'></script>\n"; 1637 1633 $this->assertEqualHTML( $expected, $output, '<body>', 'Scripts registered with no strategy assigned, and who have no dependencies, should have no loading strategy attributes printed.' ); 1638 1634 } … … 1691 1687 $actual_footer = get_echo( 'wp_print_scripts' ); 1692 1688 1693 $expected_header = "<script type='text/javascript'src='/header-old.js' id='header-old-js'></script>\n";1694 $expected_header .= "<script type='text/javascript'src='/header-new.js' id='header-new-js'></script>\n";1695 $expected_header .= "<script type='text/javascript'src='/enqueue-header-old.js' id='enqueue-header-old-js'></script>\n";1696 $expected_header .= "<script type='text/javascript'src='/enqueue-header-new.js' id='enqueue-header-new-js'></script>\n";1689 $expected_header = "<script src='/header-old.js' id='header-old-js'></script>\n"; 1690 $expected_header .= "<script src='/header-new.js' id='header-new-js'></script>\n"; 1691 $expected_header .= "<script src='/enqueue-header-old.js' id='enqueue-header-old-js'></script>\n"; 1692 $expected_header .= "<script src='/enqueue-header-new.js' id='enqueue-header-new-js'></script>\n"; 1697 1693 1698 1694 $this->assertEqualHTML( $expected_header, $actual_header, '<body>', 'Scripts registered/enqueued using the older $in_footer parameter or the newer $args parameter should have the same outcome.' ); … … 1718 1714 $actual_footer = get_echo( 'wp_print_scripts' ); 1719 1715 1720 $expected_footer = "<script type='text/javascript'src='/footer-old.js' id='footer-old-js'></script>\n";1721 $expected_footer .= "<script type='text/javascript'src='/footer-new.js' id='footer-new-js'></script>\n";1722 $expected_footer .= "<script type='text/javascript'src='/enqueue-footer-old.js' id='enqueue-footer-old-js'></script>\n";1723 $expected_footer .= "<script type='text/javascript'src='/enqueue-footer-new.js' id='enqueue-footer-new-js'></script>\n";1716 $expected_footer = "<script src='/footer-old.js' id='footer-old-js'></script>\n"; 1717 $expected_footer .= "<script src='/footer-new.js' id='footer-new-js'></script>\n"; 1718 $expected_footer .= "<script src='/enqueue-footer-old.js' id='enqueue-footer-old-js'></script>\n"; 1719 $expected_footer .= "<script src='/enqueue-footer-new.js' id='enqueue-footer-new-js'></script>\n"; 1724 1720 1725 1721 $this->assertEmpty( $actual_header, 'Expected header to be empty since all scripts targeted footer.' ); … … 1844 1840 1845 1841 $this->assertEqualHTML( 1846 "<script type='text/javascript'src='/defaults.js' id='invalid-strategy-js'></script>\n",1842 "<script src='/defaults.js' id='invalid-strategy-js'></script>\n", 1847 1843 get_echo( 'wp_print_scripts' ) 1848 1844 ); … … 1869 1865 1870 1866 $this->assertEqualHTML( 1871 "<script type='text/javascript'src='/defaults.js' id='invalid-strategy-js'></script>\n",1867 "<script src='/defaults.js' id='invalid-strategy-js'></script>\n", 1872 1868 get_echo( 'wp_print_scripts' ) 1873 1869 ); … … 1890 1886 1891 1887 $this->assertEqualHTML( 1892 "<script type='text/javascript'src='/defaults.js' id='invalid-strategy-js'></script>\n",1888 "<script src='/defaults.js' id='invalid-strategy-js'></script>\n", 1893 1889 get_echo( 'wp_print_scripts' ) 1894 1890 ); … … 1920 1916 $print_scripts = get_echo( '_print_scripts' ); 1921 1917 1922 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one-concat-dep,two-concat-dep,three-concat-dep&ver={$wp_version}'></script>\n";1923 $expected .= "<script type='text/javascript'src='/main-script.js' id='main-defer-script-js' defer='defer' data-wp-strategy='defer'></script>\n";1918 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one-concat-dep,two-concat-dep,three-concat-dep&ver={$wp_version}'></script>\n"; 1919 $expected .= "<script src='/main-script.js' id='main-defer-script-js' defer='defer' data-wp-strategy='defer'></script>\n"; 1924 1920 1925 1921 $this->assertEqualHTML( $expected, $print_scripts, '<body>', 'Scripts are being incorrectly concatenated when a main script is registered with a "defer" loading strategy. Deferred scripts should not be part of the script concat loading query.' ); … … 1951 1947 $print_scripts = get_echo( '_print_scripts' ); 1952 1948 1953 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one-concat-dep-1,two-concat-dep-1,three-concat-dep-1&ver={$wp_version}'></script>\n";1954 $expected .= "<script type='text/javascript'src='/main-script.js' id='main-async-script-1-js' async='async' data-wp-strategy='async'></script>\n";1949 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one-concat-dep-1,two-concat-dep-1,three-concat-dep-1&ver={$wp_version}'></script>\n"; 1950 $expected .= "<script src='/main-script.js' id='main-async-script-1-js' async='async' data-wp-strategy='async'></script>\n"; 1955 1951 1956 1952 $this->assertEqualHTML( $expected, $print_scripts, '<body>', 'Scripts are being incorrectly concatenated when a main script is registered with an "async" loading strategy. Async scripts should not be part of the script concat loading query.' ); … … 1986 1982 $print_scripts = get_echo( '_print_scripts' ); 1987 1983 1988 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one-concat-dep-2,two-concat-dep-2,three-concat-dep-2,four-concat-dep-2,five-concat-dep-2,six-concat-dep-2&ver={$wp_version}'></script>\n";1989 $expected .= "<script type='text/javascript'src='/main-script.js' id='deferred-script-2-js' defer='defer' data-wp-strategy='defer'></script>\n";1984 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one-concat-dep-2,two-concat-dep-2,three-concat-dep-2,four-concat-dep-2,five-concat-dep-2,six-concat-dep-2&ver={$wp_version}'></script>\n"; 1985 $expected .= "<script src='/main-script.js' id='deferred-script-2-js' defer='defer' data-wp-strategy='defer'></script>\n"; 1990 1986 1991 1987 $this->assertEqualHTML( $expected, $print_scripts, '<body>', 'Scripts are being incorrectly concatenated when a main script is registered as deferred after other blocking scripts are registered. Deferred scripts should not be part of the script concat loader query string. ' ); … … 2026 2022 // Try with an HTTP reference. 2027 2023 wp_enqueue_script( 'jquery-http', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' ); 2028 $expected .= "<script type='text/javascript'src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-http-js'></script>\n";2024 $expected .= "<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-http-js'></script>\n"; 2029 2025 2030 2026 // Try with an HTTPS reference. 2031 2027 wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' ); 2032 $expected .= "<script type='text/javascript'src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-https-js'></script>\n";2028 $expected .= "<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-https-js'></script>\n"; 2033 2029 2034 2030 // Try with an automatic protocol reference (//). 2035 2031 wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' ); 2036 $expected .= "<script type='text/javascript'src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-doubleslash-js'></script>\n";2032 $expected .= "<script src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-doubleslash-js'></script>\n"; 2037 2033 2038 2034 // Try with a local resource and an automatic protocol reference (//). 2039 2035 $url = '//my_plugin/script.js'; 2040 2036 wp_enqueue_script( 'plugin-script', $url ); 2041 $expected .= "<script type='text/javascript'src='$url?ver={$wp_version}' id='plugin-script-js'></script>\n";2037 $expected .= "<script src='$url?ver={$wp_version}' id='plugin-script-js'></script>\n"; 2042 2038 2043 2039 // Try with a bad protocol. 2044 2040 wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' ); 2045 $expected .= "<script type='text/javascript'src='{$wp_scripts->base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-ftp-js'></script>\n";2041 $expected .= "<script src='{$wp_scripts->base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver={$wp_version}' id='jquery-ftp-js'></script>\n"; 2046 2042 2047 2043 // Go! … … 2071 2067 $print_scripts = get_echo( '_print_scripts' ); 2072 2068 2073 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one,two,three&ver={$wp_version}'></script>\n";2069 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one,two,three&ver={$wp_version}'></script>\n"; 2074 2070 2075 2071 $this->assertSame( $expected, $print_scripts ); … … 2085 2081 wp_enqueue_script( 'test-only-data', 'example.com', array(), null ); 2086 2082 wp_script_add_data( 'test-only-data', 'data', 'testing' ); 2087 $expected = "<script type='text/javascript'id='test-only-data-js-extra'>\n/* <![CDATA[ */\ntesting\n//# sourceURL=test-only-data-js-extra\n/* ]]> */\n</script>\n";2088 $expected .= "<script type='text/javascript'src='http://example.com' id='test-only-data-js'></script>\n";2083 $expected = "<script id='test-only-data-js-extra'>\n/* <![CDATA[ */\ntesting\n//# sourceURL=test-only-data-js-extra\n/* ]]> */\n</script>\n"; 2084 $expected .= "<script src='http://example.com' id='test-only-data-js'></script>\n"; 2089 2085 2090 2086 // Go! … … 2121 2117 wp_enqueue_script( 'test-invalid', 'example.com', array(), null ); 2122 2118 wp_script_add_data( 'test-invalid', 'invalid', 'testing' ); 2123 $expected = "<script type='text/javascript'src='http://example.com' id='test-invalid-js'></script>\n";2119 $expected = "<script src='http://example.com' id='test-invalid-js'></script>\n"; 2124 2120 2125 2121 // Go! … … 2144 2140 */ 2145 2141 public function test_wp_register_script_with_handle_without_source() { 2146 $expected = "<script type='text/javascript'src='http://example.com?ver=1' id='handle-one-js'></script>\n";2147 $expected .= "<script type='text/javascript'src='http://example.com?ver=2' id='handle-two-js'></script>\n";2142 $expected = "<script src='http://example.com?ver=1' id='handle-one-js'></script>\n"; 2143 $expected .= "<script src='http://example.com?ver=2' id='handle-two-js'></script>\n"; 2148 2144 2149 2145 wp_register_script( 'handle-one', 'http://example.com', array(), 1 ); … … 2237 2233 $footer = get_echo( 'wp_print_footer_scripts' ); 2238 2234 2239 $expected_header = "<script type='text/javascript'src='/child-footer.js' id='child-footer-js'></script>\n";2240 $expected_header .= "<script type='text/javascript'src='/child-head.js' id='child-head-js'></script>\n";2241 $expected_footer = "<script type='text/javascript'src='/parent.js' id='parent-js'></script>\n";2235 $expected_header = "<script src='/child-footer.js' id='child-footer-js'></script>\n"; 2236 $expected_header .= "<script src='/child-head.js' id='child-head-js'></script>\n"; 2237 $expected_footer = "<script src='/parent.js' id='parent-js'></script>\n"; 2242 2238 2243 2239 $this->assertEqualHTML( $expected_header, $header, '<body>', 'Expected same header markup.' ); … … 2258 2254 $footer = get_echo( 'wp_print_footer_scripts' ); 2259 2255 2260 $expected_header = "<script type='text/javascript'src='/child-head.js' id='child-head-js'></script>\n";2261 $expected_footer = "<script type='text/javascript'src='/child-footer.js' id='child-footer-js'></script>\n";2262 $expected_footer .= "<script type='text/javascript'src='/parent.js' id='parent-js'></script>\n";2256 $expected_header = "<script src='/child-head.js' id='child-head-js'></script>\n"; 2257 $expected_footer = "<script src='/child-footer.js' id='child-footer-js'></script>\n"; 2258 $expected_footer .= "<script src='/parent.js' id='parent-js'></script>\n"; 2263 2259 2264 2260 $this->assertEqualHTML( $expected_header, $header, '<body>', 'Expected same header markup.' ); … … 2284 2280 $footer = get_echo( 'wp_print_footer_scripts' ); 2285 2281 2286 $expected_header = "<script type='text/javascript'src='/child-head.js' id='child-head-js'></script>\n";2287 $expected_header .= "<script type='text/javascript'src='/grandchild-head.js' id='grandchild-head-js'></script>\n";2288 $expected_header .= "<script type='text/javascript'src='/child2-head.js' id='child2-head-js'></script>\n";2289 $expected_header .= "<script type='text/javascript'src='/parent-header.js' id='parent-header-js'></script>\n";2290 2291 $expected_footer = "<script type='text/javascript'src='/child-footer.js' id='child-footer-js'></script>\n";2292 $expected_footer .= "<script type='text/javascript'src='/child2-footer.js' id='child2-footer-js'></script>\n";2293 $expected_footer .= "<script type='text/javascript'src='/parent-footer.js' id='parent-footer-js'></script>\n";2282 $expected_header = "<script src='/child-head.js' id='child-head-js'></script>\n"; 2283 $expected_header .= "<script src='/grandchild-head.js' id='grandchild-head-js'></script>\n"; 2284 $expected_header .= "<script src='/child2-head.js' id='child2-head-js'></script>\n"; 2285 $expected_header .= "<script src='/parent-header.js' id='parent-header-js'></script>\n"; 2286 2287 $expected_footer = "<script src='/child-footer.js' id='child-footer-js'></script>\n"; 2288 $expected_footer .= "<script src='/child2-footer.js' id='child2-footer-js'></script>\n"; 2289 $expected_footer .= "<script src='/parent-footer.js' id='parent-footer-js'></script>\n"; 2294 2290 2295 2291 $this->assertEqualHTML( $expected_header, $header, '<body>', 'Expected same header markup.' ); … … 2322 2318 2323 2319 $expected = <<<HTML 2324 <script type='text/javascript'id='test-example-js-before'>2320 <script id='test-example-js-before'> 2325 2321 /* <![CDATA[ */ 2326 2322 console.log("before"); … … 2329 2325 </script> 2330 2326 HTML; 2331 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2327 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 2332 2328 2333 2329 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2341 2337 wp_add_inline_script( 'test-example', 'console.log("after");' ); 2342 2338 2343 $expected = "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2339 $expected = "<script src='http://example.com' id='test-example-js'></script>\n"; 2344 2340 $expected .= <<<HTML 2345 <script type='text/javascript'id='test-example-js-after'>2341 <script id='test-example-js-after'> 2346 2342 /* <![CDATA[ */ 2347 2343 console.log("after"); … … 2362 2358 wp_add_inline_script( 'test-example', 'console.log("after");' ); 2363 2359 2364 $expected = "<script type='text/javascript'id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n";2365 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2366 $expected .= "<script type='text/javascript'id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n";2360 $expected = "<script id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n"; 2361 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 2362 $expected .= "<script id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2367 2363 2368 2364 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2377 2373 wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); 2378 2374 2379 $expected = "<script type='text/javascript'id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n";2375 $expected = "<script id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n"; 2380 2376 2381 2377 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2390 2386 wp_add_inline_script( 'test-example', 'console.log("after");' ); 2391 2387 2392 $expected = "<script type='text/javascript'id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n";2388 $expected = "<script id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2393 2389 2394 2390 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2404 2400 wp_add_inline_script( 'test-example', 'console.log("after");' ); 2405 2401 2406 $expected = "<script type='text/javascript'id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n";2407 $expected .= "<script type='text/javascript'id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n";2402 $expected = "<script id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n"; 2403 $expected .= "<script id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2408 2404 2409 2405 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2420 2416 wp_add_inline_script( 'test-example', 'console.log("after");' ); 2421 2417 2422 $expected = "<script type='text/javascript'id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n";2423 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2424 $expected .= "<script type='text/javascript'id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n";2418 $expected = "<script id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n"; 2419 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 2420 $expected .= "<script id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2425 2421 2426 2422 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2436 2432 wp_add_inline_script( 'test-example', 'console.log("after");' ); 2437 2433 2438 $expected = "<script type='text/javascript'id='test-example-js-extra'>\n/* <![CDATA[ */\nvar testExample = {\"foo\":\"bar\"};\n//# sourceURL=test-example-js-extra\n/* ]]> */\n</script>\n";2439 $expected .= "<script type='text/javascript'id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n";2440 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2441 $expected .= "<script type='text/javascript'id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n";2434 $expected = "<script id='test-example-js-extra'>\n/* <![CDATA[ */\nvar testExample = {\"foo\":\"bar\"};\n//# sourceURL=test-example-js-extra\n/* ]]> */\n</script>\n"; 2435 $expected .= "<script id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n"; 2436 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 2437 $expected .= "<script id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2442 2438 2443 2439 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2460 2456 wp_add_inline_script( 'two', 'console.log("before two");', 'before' ); 2461 2457 2462 $expected = "<script type='text/javascript'id='one-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before one\");\n//# sourceURL=one-js-before\n/* ]]> */\n</script>\n";2463 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}one.js?ver={$wp_version}' id='one-js'></script>\n";2464 $expected .= "<script type='text/javascript'id='two-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before two\");\n//# sourceURL=two-js-before\n/* ]]> */\n</script>\n";2465 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n";2466 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n";2458 $expected = "<script id='one-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before one\");\n//# sourceURL=one-js-before\n/* ]]> */\n</script>\n"; 2459 $expected .= "<script src='{$this->default_scripts_dir}one.js?ver={$wp_version}' id='one-js'></script>\n"; 2460 $expected .= "<script id='two-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before two\");\n//# sourceURL=two-js-before\n/* ]]> */\n</script>\n"; 2461 $expected .= "<script src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n"; 2462 $expected .= "<script src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n"; 2467 2463 2468 2464 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2484 2480 wp_add_inline_script( 'one', 'console.log("before one");', 'before' ); 2485 2481 2486 $expected = "<script type='text/javascript'id='one-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before one\");\n//# sourceURL=one-js-before\n/* ]]> */\n</script>\n";2487 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}one.js?ver={$wp_version}' id='one-js'></script>\n";2488 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n";2489 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n";2482 $expected = "<script id='one-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before one\");\n//# sourceURL=one-js-before\n/* ]]> */\n</script>\n"; 2483 $expected .= "<script src='{$this->default_scripts_dir}one.js?ver={$wp_version}' id='one-js'></script>\n"; 2484 $expected .= "<script src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n"; 2485 $expected .= "<script src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n"; 2490 2486 2491 2487 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2509 2505 wp_add_inline_script( 'three', 'console.log("after three");' ); 2510 2506 2511 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one&ver={$wp_version}'></script>\n";2512 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n";2513 $expected .= "<script type='text/javascript'id='two-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after two\");\n//# sourceURL=two-js-after\n/* ]]> */\n</script>\n";2514 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n";2515 $expected .= "<script type='text/javascript'id='three-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after three\");\n//# sourceURL=three-js-after\n/* ]]> */\n</script>\n";2516 $expected .= "<script type='text/javascript'src='{$this->default_scripts_dir}four.js?ver={$wp_version}' id='four-js'></script>\n";2507 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one&ver={$wp_version}'></script>\n"; 2508 $expected .= "<script src='{$this->default_scripts_dir}two.js?ver={$wp_version}' id='two-js'></script>\n"; 2509 $expected .= "<script id='two-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after two\");\n//# sourceURL=two-js-after\n/* ]]> */\n</script>\n"; 2510 $expected .= "<script src='{$this->default_scripts_dir}three.js?ver={$wp_version}' id='three-js'></script>\n"; 2511 $expected .= "<script id='three-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after three\");\n//# sourceURL=three-js-after\n/* ]]> */\n</script>\n"; 2512 $expected .= "<script src='{$this->default_scripts_dir}four.js?ver={$wp_version}' id='four-js'></script>\n"; 2517 2513 2518 2514 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2557 2553 $wp_scripts->do_concat = true; 2558 2554 2559 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$wp_version}'></script>\n";2560 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2561 $expected .= "<script type='text/javascript'id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n";2555 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$wp_version}'></script>\n"; 2556 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 2557 $expected .= "<script id='test-example-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example-js-after\n/* ]]> */\n</script>\n"; 2562 2558 2563 2559 wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); … … 2606 2602 $wp_scripts->do_concat = true; 2607 2603 2608 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$wp_version}'></script>\n";2609 $expected .= "<script type='text/javascript'id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n";2610 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2604 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$wp_version}'></script>\n"; 2605 $expected .= "<script id='test-example-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n</script>\n"; 2606 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 2611 2607 2612 2608 wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); … … 2631 2627 $wp_scripts->do_concat = true; 2632 2628 2633 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,wp-dom-ready,wp-hooks&ver={$wp_version}'></script>\n";2634 $expected .= "<script type='text/javascript'id='test-example-js-before'>\n";2629 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,wp-dom-ready,wp-hooks&ver={$wp_version}'></script>\n"; 2630 $expected .= "<script id='test-example-js-before'>\n"; 2635 2631 $expected .= "/* <![CDATA[ */\nconsole.log(\"before\");\n//# sourceURL=test-example-js-before\n/* ]]> */\n"; 2636 2632 $expected .= "</script>\n"; 2637 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";2638 $expected .= "<script type='text/javascript'src='/wp-includes/js/dist/i18n.min.js' id='wp-i18n-js'></script>\n";2639 $expected .= "<script type='text/javascript'id='wp-i18n-js-after'>\n";2633 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 2634 $expected .= "<script src='/wp-includes/js/dist/i18n.min.js' id='wp-i18n-js'></script>\n"; 2635 $expected .= "<script id='wp-i18n-js-after'>\n"; 2640 2636 $expected .= "/* <![CDATA[ */\n"; 2641 2637 $expected .= "wp.i18n.setLocaleData( { 'text direction\u0004ltr': [ 'ltr' ] } );\n"; … … 2643 2639 $expected .= "/* ]]> */\n"; 2644 2640 $expected .= "</script>\n"; 2645 $expected .= "<script type='text/javascript'src='/wp-includes/js/dist/a11y.min.js' id='wp-a11y-js'></script>\n";2646 $expected .= "<script type='text/javascript'src='http://example2.com' id='test-example2-js'></script>\n";2647 $expected .= "<script type='text/javascript'id='test-example2-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example2-js-after\n/* ]]> */\n</script>\n";2641 $expected .= "<script src='/wp-includes/js/dist/a11y.min.js' id='wp-a11y-js'></script>\n"; 2642 $expected .= "<script src='http://example2.com' id='test-example2-js'></script>\n"; 2643 $expected .= "<script id='test-example2-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after\");\n//# sourceURL=test-example2-js-after\n/* ]]> */\n</script>\n"; 2648 2644 wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); 2649 2645 wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); … … 2696 2692 $print_scripts = $this->getActualOutput(); 2697 2693 2698 $expected = "<script type='text/javascript'src='/customize-dependency.js' id='customize-dependency-js'></script>\n";2694 $expected = "<script src='/customize-dependency.js' id='customize-dependency-js'></script>\n"; 2699 2695 $this->assertEqualHTMLScriptTagById( $expected, $print_scripts ); 2700 2696 2701 $expected = "<script type='text/javascript'id='customize-dependency-js-after'>\n";2697 $expected = "<script id='customize-dependency-js-after'>\n"; 2702 2698 $expected .= "/* <![CDATA[ */\n"; 2703 2699 $expected .= "tryCustomizeDependency()\n"; … … 2723 2719 wp_enqueue_script( 'four', '/wp-includes/js/script4.js' ); 2724 2720 2725 $expected = "<script type='text/javascript'src='/wp-includes/js/script.js?ver={$wp_version}' id='one-js'></script>\n";2726 $expected .= "<script type='text/javascript'id='one-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after one\");\n//# sourceURL=one-js-after\n/* ]]> */\n</script>\n";2727 $expected .= "<script type='text/javascript'src='/wp-includes/js/script2.js?ver={$wp_version}' id='two-js'></script>\n";2728 $expected .= "<script type='text/javascript'src='/wp-includes/js/script3.js?ver={$wp_version}' id='three-js'></script>\n";2729 $expected .= "<script type='text/javascript'src='/wp-includes/js/script4.js?ver={$wp_version}' id='four-js'></script>\n";2721 $expected = "<script src='/wp-includes/js/script.js?ver={$wp_version}' id='one-js'></script>\n"; 2722 $expected .= "<script id='one-js-after'>\n/* <![CDATA[ */\nconsole.log(\"after one\");\n//# sourceURL=one-js-after\n/* ]]> */\n</script>\n"; 2723 $expected .= "<script src='/wp-includes/js/script2.js?ver={$wp_version}' id='two-js'></script>\n"; 2724 $expected .= "<script src='/wp-includes/js/script3.js?ver={$wp_version}' id='three-js'></script>\n"; 2725 $expected .= "<script src='/wp-includes/js/script4.js?ver={$wp_version}' id='four-js'></script>\n"; 2730 2726 2731 2727 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2747 2743 wp_enqueue_script( 'four', '/wp-includes/js/script4.js' ); 2748 2744 2749 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one,two&ver={$wp_version}'></script>\n";2750 $expected .= "<script type='text/javascript'id='three-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before three\");\n//# sourceURL=three-js-before\n/* ]]> */\n</script>\n";2751 $expected .= "<script type='text/javascript'src='/wp-includes/js/script3.js?ver={$wp_version}' id='three-js'></script>\n";2752 $expected .= "<script type='text/javascript'src='/wp-includes/js/script4.js?ver={$wp_version}' id='four-js'></script>\n";2745 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=one,two&ver={$wp_version}'></script>\n"; 2746 $expected .= "<script id='three-js-before'>\n/* <![CDATA[ */\nconsole.log(\"before three\");\n//# sourceURL=three-js-before\n/* ]]> */\n</script>\n"; 2747 $expected .= "<script src='/wp-includes/js/script3.js?ver={$wp_version}' id='three-js'></script>\n"; 2748 $expected .= "<script src='/wp-includes/js/script4.js?ver={$wp_version}' id='four-js'></script>\n"; 2753 2749 2754 2750 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2769 2765 'delayed' => false, 2770 2766 'expected_data' => "/*before foo 1*/\n//# sourceURL=foo-js-before", 2771 'expected_tag' => "<script id='foo-js-before' type='text/javascript'>\n/* <![CDATA[ */\n/*before foo 1*/\n//# sourceURL=foo-js-before\n/* ]]> */\n</script>\n",2767 'expected_tag' => "<script id='foo-js-before'>\n/* <![CDATA[ */\n/*before foo 1*/\n//# sourceURL=foo-js-before\n/* ]]> */\n</script>\n", 2772 2768 ), 2773 2769 'after-blocking' => array( … … 2779 2775 'delayed' => false, 2780 2776 'expected_data' => "/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after", 2781 'expected_tag' => "<script id='foo-js-after' type='text/javascript'>\n/* <![CDATA[ */\n/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after\n/* ]]> */\n</script>\n",2777 'expected_tag' => "<script id='foo-js-after'>\n/* <![CDATA[ */\n/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after\n/* ]]> */\n</script>\n", 2782 2778 ), 2783 2779 'before-delayed' => array( … … 2788 2784 'delayed' => true, 2789 2785 'expected_data' => "/*before foo 1*/\n//# sourceURL=foo-js-before", 2790 'expected_tag' => "<script id='foo-js-before' type='text/javascript'>\n/* <![CDATA[ */\n/*before foo 1*/\n//# sourceURL=foo-js-before\n/* ]]> */\n</script>\n",2786 'expected_tag' => "<script id='foo-js-before'>\n/* <![CDATA[ */\n/*before foo 1*/\n//# sourceURL=foo-js-before\n/* ]]> */\n</script>\n", 2791 2787 ), 2792 2788 'after-delayed' => array( … … 2798 2794 'delayed' => true, 2799 2795 'expected_data' => "/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after", 2800 'expected_tag' => "<script id='foo-js-after' type='text/javascript'>\n/* <![CDATA[ */\n/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after\n/* ]]> */\n</script>\n",2796 'expected_tag' => "<script id='foo-js-after'>\n/* <![CDATA[ */\n/*after foo 1*/\n/*after foo 2*/\n//# sourceURL=foo-js-after\n/* ]]> */\n</script>\n", 2801 2797 ), 2802 2798 ); … … 2868 2864 wp_set_script_translations( 'test-example', 'default', DIR_TESTDATA . '/languages' ); 2869 2865 2870 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";2866 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 2871 2867 $expected .= str_replace( 2872 2868 array( … … 2882 2878 $this->wp_scripts_print_translations_output 2883 2879 ); 2884 $expected .= "<script type='text/javascript'src='/wp-includes/js/script.js' id='test-example-js'></script>\n";2880 $expected .= "<script src='/wp-includes/js/script.js' id='test-example-js'></script>\n"; 2885 2881 2886 2882 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2900 2896 wp_set_script_translations( 'domain-path-plugin', 'internationalized-plugin' ); 2901 2897 2902 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";2898 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 2903 2899 $expected .= str_replace( 2904 2900 array( … … 2914 2910 $this->wp_scripts_print_translations_output 2915 2911 ); 2916 $expected .= "<script type='text/javascript'src='/wp-content/plugins/my-plugin/js/script.js' id='domain-path-plugin-js'></script>\n";2912 $expected .= "<script src='/wp-content/plugins/my-plugin/js/script.js' id='domain-path-plugin-js'></script>\n"; 2917 2913 2918 2914 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2935 2931 wp_set_script_translations( 'script-handle', 'admin' ); 2936 2932 2937 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";2933 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 2938 2934 $expected .= str_replace( 2939 2935 array( … … 2949 2945 $this->wp_scripts_print_translations_output 2950 2946 ); 2951 $expected .= "<script type='text/javascript'src='/wp-admin/js/script.js' id='script-handle-js'></script>\n";2947 $expected .= "<script src='/wp-admin/js/script.js' id='script-handle-js'></script>\n"; 2952 2948 2953 2949 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2962 2958 wp_set_script_translations( 'plugin-example', 'internationalized-plugin', DIR_TESTDATA . '/languages/plugins' ); 2963 2959 2964 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";2960 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 2965 2961 $expected .= str_replace( 2966 2962 array( … … 2976 2972 $this->wp_scripts_print_translations_output 2977 2973 ); 2978 $expected .= "<script type='text/javascript'src='/wp-content/plugins/my-plugin/js/script.js' id='plugin-example-js'></script>\n";2974 $expected .= "<script src='/wp-content/plugins/my-plugin/js/script.js' id='plugin-example-js'></script>\n"; 2979 2975 2980 2976 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 2989 2985 wp_set_script_translations( 'theme-example', 'internationalized-theme', DIR_TESTDATA . '/languages/themes' ); 2990 2986 2991 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";2987 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 2992 2988 $expected .= str_replace( 2993 2989 array( … … 3003 2999 $this->wp_scripts_print_translations_output 3004 3000 ); 3005 $expected .= "<script type='text/javascript'src='/wp-content/themes/my-theme/js/script.js' id='theme-example-js'></script>\n";3001 $expected .= "<script src='/wp-content/themes/my-theme/js/script.js' id='theme-example-js'></script>\n"; 3006 3002 3007 3003 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 3016 3012 wp_set_script_translations( 'script-handle', 'admin', DIR_TESTDATA . '/languages/' ); 3017 3013 3018 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";3014 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 3019 3015 $expected .= str_replace( 3020 3016 array( … … 3030 3026 $this->wp_scripts_print_translations_output 3031 3027 ); 3032 $expected .= "<script type='text/javascript'src='/wp-admin/js/script.js' id='script-handle-js'></script>\n";3028 $expected .= "<script src='/wp-admin/js/script.js' id='script-handle-js'></script>\n"; 3033 3029 3034 3030 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 3059 3055 wp_set_script_translations( 'test-example', 'admin', DIR_TESTDATA . '/languages/' ); 3060 3056 3061 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";3062 $expected .= "<script type='text/javascript'src='/wp-admin/js/script.js' id='test-example-js'></script>\n";3057 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 3058 $expected .= "<script src='/wp-admin/js/script.js' id='test-example-js'></script>\n"; 3063 3059 3064 3060 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 3075 3071 wp_enqueue_script( 'test-example' ); 3076 3072 3077 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";3073 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 3078 3074 $expected .= str_replace( 3079 3075 array( … … 3089 3085 $this->wp_scripts_print_translations_output 3090 3086 ); 3091 $expected .= "<script type='text/javascript'src='/wp-includes/js/script.js' id='test-example-js'></script>\n";3087 $expected .= "<script src='/wp-includes/js/script.js' id='test-example-js'></script>\n"; 3092 3088 3093 3089 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 3104 3100 wp_enqueue_script( 'test-example', '/wp-includes/js/script2.js', array( 'test-dependency' ), null ); 3105 3101 3106 $expected = "<script type='text/javascript'src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n";3102 $expected = "<script src='/wp-includes/js/dist/wp-i18n.js' id='wp-i18n-js'></script>\n"; 3107 3103 $expected .= str_replace( 3108 3104 array( … … 3118 3114 $this->wp_scripts_print_translations_output 3119 3115 ); 3120 $expected .= "<script type='text/javascript'src='/wp-includes/js/script.js' id='test-dependency-js'></script>\n";3121 $expected .= "<script type='text/javascript'src='/wp-includes/js/script2.js' id='test-example-js'></script>\n";3116 $expected .= "<script src='/wp-includes/js/script.js' id='test-dependency-js'></script>\n"; 3117 $expected .= "<script src='/wp-includes/js/script2.js' id='test-example-js'></script>\n"; 3122 3118 3123 3119 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 3507 3503 wp_localize_script( 'test-example', 'testExample', $l10n_data ); 3508 3504 3509 $expected = "<script type='text/javascript'id='test-example-js-extra'>\n/* <![CDATA[ */\nvar testExample = {$expected};\n//# sourceURL=test-example-js-extra\n/* ]]> */\n</script>\n";3510 $expected .= "<script type='text/javascript'src='http://example.com' id='test-example-js'></script>\n";3505 $expected = "<script id='test-example-js-extra'>\n/* <![CDATA[ */\nvar testExample = {$expected};\n//# sourceURL=test-example-js-extra\n/* ]]> */\n</script>\n"; 3506 $expected .= "<script src='http://example.com' id='test-example-js'></script>\n"; 3511 3507 3512 3508 $this->assertEqualHTML( $expected, get_echo( 'wp_print_scripts' ) ); … … 3571 3567 3572 3568 // The non-default script should end concatenation and maintain order. 3573 $expected = "<script type='text/javascript'src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$wp_version}'></script>\n";3574 $expected .= "<script type='text/javascript'src='/plugins/wp-i18n.js' id='wp-i18n-js'></script>\n";3575 $expected .= "<script type='text/javascript'src='/default/common.js' id='common-js'></script>\n";3569 $expected = "<script src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$wp_version}'></script>\n"; 3570 $expected .= "<script src='/plugins/wp-i18n.js' id='wp-i18n-js'></script>\n"; 3571 $expected .= "<script src='/default/common.js' id='common-js'></script>\n"; 3576 3572 3577 3573 $this->assertEqualHTML( $expected, $print_scripts ); … … 3699 3695 'expected_header' => '', 3700 3696 'expected_footer' => ' 3701 <script type="text/javascript"src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script>3702 <script type="text/javascript"src="https://example.com/script-b.js" id="script-b-js"></script>3697 <script src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script> 3698 <script src="https://example.com/script-b.js" id="script-b-js"></script> 3703 3699 ', 3704 3700 'expected_in_footer' => array( … … 3720 3716 'expected_header' => '', 3721 3717 'expected_footer' => ' 3722 <script type="text/javascript"src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="async"></script>3723 <script type="text/javascript"src="https://example.com/script-b.js" id="script-b-js"></script>3718 <script src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="async"></script> 3719 <script src="https://example.com/script-b.js" id="script-b-js"></script> 3724 3720 ', 3725 3721 'expected_in_footer' => array( … … 3740 3736 }, 3741 3737 'expected_header' => ' 3742 <script type="text/javascript"src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script>3743 <script type="text/javascript"src="https://example.com/script-b.js" id="script-b-js"></script>3738 <script src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script> 3739 <script src="https://example.com/script-b.js" id="script-b-js"></script> 3744 3740 ', 3745 3741 'expected_footer' => '', … … 3767 3763 }, 3768 3764 'expected_header' => ' 3769 <script type="text/javascript"src="https://example.com/script-a.js" id="script-a-js" defer="defer" data-wp-strategy="defer"></script>3765 <script src="https://example.com/script-a.js" id="script-a-js" defer="defer" data-wp-strategy="defer"></script> 3770 3766 ', 3771 3767 'expected_footer' => ' 3772 <script type="text/javascript"src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script>3768 <script src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script> 3773 3769 ', 3774 3770 'expected_in_footer' => array( … … 3817 3813 }, 3818 3814 'expected_header' => ' 3819 <script type="text/javascript"src="https://example.com/script-a.js" id="script-a-js" defer="defer" data-wp-strategy="defer"></script>3820 <script type="text/javascript"src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script>3815 <script src="https://example.com/script-a.js" id="script-a-js" defer="defer" data-wp-strategy="defer"></script> 3816 <script src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script> 3821 3817 ', 3822 3818 'expected_footer' => ' 3823 <script type="text/javascript"src="https://example.com/script-c.js" id="script-c-js" defer="defer" data-wp-strategy="defer"></script>3824 <script type="text/javascript"src="https://example.com/script-d.js" id="script-d-js" defer="defer" data-wp-strategy="defer"></script>3819 <script src="https://example.com/script-c.js" id="script-c-js" defer="defer" data-wp-strategy="defer"></script> 3820 <script src="https://example.com/script-d.js" id="script-d-js" defer="defer" data-wp-strategy="defer"></script> 3825 3821 ', 3826 3822 'expected_in_footer' => array( … … 3864 3860 'expected_header' => '', 3865 3861 'expected_footer' => ' 3866 <script type="text/javascript"src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script>3867 <script type="text/javascript"src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script>3868 <script type="text/javascript"src="https://example.com/script-c.js" id="script-c-js"></script>3869 <script type="text/javascript"src="https://example.com/script-d.js" id="script-d-js" defer="defer" data-wp-strategy="defer"></script>3862 <script src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script> 3863 <script src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script> 3864 <script src="https://example.com/script-c.js" id="script-c-js"></script> 3865 <script src="https://example.com/script-d.js" id="script-d-js" defer="defer" data-wp-strategy="defer"></script> 3870 3866 ', 3871 3867 'expected_in_footer' => array( … … 3911 3907 }, 3912 3908 'expected_header' => ' 3913 <script type="text/javascript"src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script>3914 <script type="text/javascript"src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script>3909 <script src="https://example.com/script-a.js" id="script-a-js" data-wp-strategy="defer"></script> 3910 <script src="https://example.com/script-b.js" id="script-b-js" defer="defer" data-wp-strategy="defer"></script> 3915 3911 ', 3916 3912 'expected_footer' => ' 3917 <script type="text/javascript"src="https://example.com/script-c.js" id="script-c-js"></script>3918 <script type="text/javascript"src="https://example.com/script-d.js" id="script-d-js" defer="defer" data-wp-strategy="defer"></script>3913 <script src="https://example.com/script-c.js" id="script-c-js"></script> 3914 <script src="https://example.com/script-d.js" id="script-d-js" defer="defer" data-wp-strategy="defer"></script> 3919 3915 ', 3920 3916 'expected_in_footer' => array( … … 4207 4203 $markup = get_echo( 'wp_print_scripts' ); 4208 4204 4209 $expected = "<script type='text/javascript'src='/test-script.js?{$expected_query_string}' id='test-script-js'></script>";4205 $expected = "<script src='/test-script.js?{$expected_query_string}' id='test-script-js'></script>"; 4210 4206 $this->assertEqualHTML( $expected, $markup, '<body>', 'Expected equal snapshot for wp_print_scripts() with version ' . var_export( $version, true ) . ":\n$markup" ); 4211 4207 } … … 4228 4224 $markup = get_echo( 'wp_print_scripts' ); 4229 4225 4230 $expected = "<script type='text/javascript'src='/test-script.js?{$expected_query_string}' id='test-script-js'></script>";4226 $expected = "<script src='/test-script.js?{$expected_query_string}' id='test-script-js'></script>"; 4231 4227 $this->assertEqualHTML( $expected, $markup, '<body>', 'Expected equal snapshot for wp_print_scripts() with version ' . var_export( $version, true ) . ":\n$markup" ); 4232 4228 } -
trunk/tests/phpunit/tests/dependencies/styles.php
r61397 r61411 69 69 70 70 $ver = get_bloginfo( 'version' ); 71 $expected = "<link rel='stylesheet' id='no-deps-no-version-css' href='http://example.com?ver=$ver' type='text/css'media='all' />\n";72 $expected .= "<link rel='stylesheet' id='no-deps-version-css' href='http://example.com?ver=1.2' type='text/css'media='all' />\n";73 $expected .= "<link rel='stylesheet' id='no-deps-null-version-css' href='http://example.com' type='text/css'media='all' />\n";74 $expected .= "<link rel='stylesheet' id='no-deps-null-version-print-media-css' href='http://example.com' type='text/css'media='print' />\n";75 $expected .= "<link rel='stylesheet' id='no-deps-arg-in-handle-with-ver-css' href='https://example.com/test.css?ver=2.0&arg1=foo&arg2=bar' type='text/css'media='all' />\n";76 $expected .= "<link rel='stylesheet' id='no-deps-arg-in-handle-without-ver-css' href='https://example.com/test.css?arg1=foo&arg2=bar' type='text/css'media='all' />\n";77 $expected .= "<link rel='stylesheet' id='registered-no-qs-handle-null-version-enqueued-with-qs-css' href='https://example.com/test.css?ver={$ver}&arg1=foo&arg2=bar' type='text/css'media='all' />\n";71 $expected = "<link rel='stylesheet' id='no-deps-no-version-css' href='http://example.com?ver=$ver' media='all' />\n"; 72 $expected .= "<link rel='stylesheet' id='no-deps-version-css' href='http://example.com?ver=1.2' media='all' />\n"; 73 $expected .= "<link rel='stylesheet' id='no-deps-null-version-css' href='http://example.com' media='all' />\n"; 74 $expected .= "<link rel='stylesheet' id='no-deps-null-version-print-media-css' href='http://example.com' media='print' />\n"; 75 $expected .= "<link rel='stylesheet' id='no-deps-arg-in-handle-with-ver-css' href='https://example.com/test.css?ver=2.0&arg1=foo&arg2=bar' media='all' />\n"; 76 $expected .= "<link rel='stylesheet' id='no-deps-arg-in-handle-without-ver-css' href='https://example.com/test.css?arg1=foo&arg2=bar' media='all' />\n"; 77 $expected .= "<link rel='stylesheet' id='registered-no-qs-handle-null-version-enqueued-with-qs-css' href='https://example.com/test.css?ver={$ver}&arg1=foo&arg2=bar' media='all' />\n"; 78 78 79 79 $this->assertEqualHTML( $expected, get_echo( 'wp_print_styles' ) ); … … 110 110 wp_enqueue_style( $handle, 'example.com', array(), null ); 111 111 112 $expected = "<link rel='stylesheet' id='$handle-css' href='http://example.com' type='text/css'media='all' />\n";112 $expected = "<link rel='stylesheet' id='$handle-css' href='http://example.com' media='all' />\n"; 113 113 114 114 $this->assertEqualHTML( $expected, get_echo( 'wp_print_styles' ) ); … … 146 146 // Try with an HTTP reference. 147 147 wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 148 $expected .= "<link rel='stylesheet' id='reset-css-http-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css'media='all' />\n";148 $expected .= "<link rel='stylesheet' id='reset-css-http-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' media='all' />\n"; 149 149 150 150 // Try with an HTTPS reference. 151 151 wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 152 $expected .= "<link rel='stylesheet' id='reset-css-https-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css'media='all' />\n";152 $expected .= "<link rel='stylesheet' id='reset-css-https-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' media='all' />\n"; 153 153 154 154 // Try with an automatic protocol reference (//). 155 155 wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 156 $expected .= "<link rel='stylesheet' id='reset-css-doubleslash-css' href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css'media='all' />\n";156 $expected .= "<link rel='stylesheet' id='reset-css-doubleslash-css' href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' media='all' />\n"; 157 157 158 158 // Try with a local resource and an automatic protocol reference (//). 159 159 $url = '//my_plugin/style.css'; 160 160 wp_enqueue_style( 'plugin-style', $url ); 161 $expected .= "<link rel='stylesheet' id='plugin-style-css' href='$url?ver=$ver' type='text/css'media='all' />\n";161 $expected .= "<link rel='stylesheet' id='plugin-style-css' href='$url?ver=$ver' media='all' />\n"; 162 162 163 163 // Try with a bad protocol. 164 164 wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 165 $expected .= "<link rel='stylesheet' id='reset-css-ftp-css' href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css'media='all' />\n";165 $expected .= "<link rel='stylesheet' id='reset-css-ftp-css' href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' media='all' />\n"; 166 166 167 167 // Go! … … 186 186 $style .= '}'; 187 187 188 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css'media='all' />\n";189 $expected .= "<style id='handle-inline-css' type='text/css'>\n";188 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' media='all' />\n"; 189 $expected .= "<style id='handle-inline-css'>\n"; 190 190 $expected .= "$style\n"; 191 191 $expected .= "/*# sourceURL=handle-inline-css */\n"; … … 214 214 $style .= '}'; 215 215 216 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css'media='all' />\n";217 $expected .= "<style id='handle-inline-css' type='text/css'>\n";216 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' media='all' />\n"; 217 $expected .= "<style id='handle-inline-css'>\n"; 218 218 $expected .= "$style\n"; 219 219 $expected .= "</style>\n"; … … 308 308 $style2 .= '}'; 309 309 310 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css'media='all' />\n";311 $expected .= "<style id='handle-inline-css' type='text/css'>\n";310 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' media='all' />\n"; 311 $expected .= "<style id='handle-inline-css'>\n"; 312 312 $expected .= "$style1\n"; 313 313 $expected .= "$style2\n"; … … 334 334 $style .= '}'; 335 335 336 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css'media='all' />\n";337 $expected .= "<style id='handle-inline-css' type='text/css'>\n";336 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' media='all' />\n"; 337 $expected .= "<style id='handle-inline-css'>\n"; 338 338 $expected .= "$style\n"; 339 339 $expected .= "/*# sourceURL=handle-inline-css */\n"; … … 354 354 public function test_unnecessary_style_tags() { 355 355 356 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' type='text/css'media='all' />\n";356 $expected = "<link rel='stylesheet' id='handle-css' href='http://example.com?ver=1' media='all' />\n"; 357 357 358 358 wp_enqueue_style( 'handle', 'http://example.com', array(), 1 ); … … 392 392 $style = 'a { color: blue; }'; 393 393 394 $expected = "<link rel='stylesheet' id='handle-one-css' href='http://example.com?ver=1' type='text/css'media='all' />\n";395 $expected .= "<link rel='stylesheet' id='handle-two-css' href='http://example.com?ver=1' type='text/css'media='all' />\n";396 $expected .= "<style id='handle-three-inline-css' type='text/css'>\n";394 $expected = "<link rel='stylesheet' id='handle-one-css' href='http://example.com?ver=1' media='all' />\n"; 395 $expected .= "<link rel='stylesheet' id='handle-two-css' href='http://example.com?ver=1' media='all' />\n"; 396 $expected .= "<style id='handle-three-inline-css'>\n"; 397 397 $expected .= "$style\n"; 398 398 $expected .= "/*# sourceURL=handle-three-inline-css */\n"; … … 629 629 $this->assertSame( 'STYLE', $processor->get_tag() ); 630 630 $this->assertSame( $handle . '-inline-css', $processor->get_attribute( 'id' ) ); 631 $this->assert Same( 'text/css',$processor->get_attribute( 'type' ) );631 $this->assertNull( $processor->get_attribute( 'type' ) ); 632 632 633 633 $expected_inline_styles = $expected_after; … … 778 778 779 779 $expected = <<<HTML 780 <link rel='stylesheet' href="/example.css?ver=0.0" id="# test/</style> #-css" media="all" type="text/css">781 <style id="# test/</style> #-inline-css" type="text/css">780 <link rel='stylesheet' href="/example.css?ver=0.0" id="# test/</style> #-css" media="all"> 781 <style id="# test/</style> #-inline-css"> 782 782 custom-el { content: "ok"; } 783 783 /*# sourceURL=%23%20test%2F%3C%2Fstyle%3E%20%23-inline-css */ … … 870 870 $markup = get_echo( 'wp_print_styles' ); 871 871 872 $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' type='text/css'media='all' />";872 $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' media='all' />"; 873 873 $this->assertEqualHTML( $expected, $markup, '<body>', 'Expected equal snapshot for wp_print_styles() with version ' . var_export( $version, true ) . ":\n$markup" ); 874 874 } … … 891 891 $markup = get_echo( 'wp_print_styles' ); 892 892 893 $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' type='text/css'media='all' />";893 $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' media='all' />"; 894 894 $this->assertEqualHTML( $expected, $markup, '<body>', 'Expected equal snapshot for wp_print_styles() with version ' . var_export( $version, true ) . ":\n$markup" ); 895 895 } -
trunk/tests/phpunit/tests/dependencies/wpInlineScriptTag.php
r61395 r61411 144 144 145 145 $this->assertSame( 146 "<script type=\"text/javascript\">\n/* <![CDATA[ */\n/* <![CDATA[ */ console.log( 'Hello World!' ); /* ]]]]><![CDATA[> */\n/* ]]> */\n</script>\n",146 "<script>\n/* <![CDATA[ */\n/* <![CDATA[ */ console.log( 'Hello World!' ); /* ]]]]><![CDATA[> */\n/* ]]> */\n</script>\n", 147 147 wp_get_inline_script_tag( "/* <![CDATA[ */ console.log( 'Hello World!' ); /* ]]> */" ) 148 148 ); -
trunk/tests/phpunit/tests/fonts/font-face/wpFontFace/generateAndPrint.php
r61409 r61411 32 32 public function test_should_generate_and_print_given_fonts( array $fonts, $expected ) { 33 33 $font_face = new WP_Font_Face(); 34 $style_element = "<style class='wp-fonts-local' type='text/css'>\n%s\n</style>\n";34 $style_element = "<style class='wp-fonts-local'>\n%s\n</style>\n"; 35 35 $expected_output = sprintf( $style_element, $expected ); 36 36 -
trunk/tests/phpunit/tests/fonts/font-face/wpPrintFontFaces.php
r61409 r61411 56 56 57 57 $expected_output = <<<CSS 58 <style class='wp-fonts-local' type='text/css'>58 <style class='wp-fonts-local'> 59 59 @font-face{font-family:"Source Serif Pro";font-style:normal;font-weight:200 900;font-display:fallback;src:url('http://example.com/assets/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2') format('woff2');font-stretch:;} 60 60 </style> … … 77 77 78 78 private function get_expected_styles_output( $styles ) { 79 $style_element = "<style class='wp-fonts-local' type='text/css'>\n%s\n</style>\n";79 $style_element = "<style class='wp-fonts-local'>\n%s\n</style>\n"; 80 80 return sprintf( $style_element, $styles ); 81 81 } -
trunk/tests/phpunit/tests/fonts/font-face/wpPrintFontFacesFromStyleVariations.php
r61409 r61411 49 49 50 50 private function get_expected_styles_output( $styles ) { 51 $style_element = "<style class='wp-fonts-local' type='text/css'>\n%s\n</style>\n";51 $style_element = "<style class='wp-fonts-local'>\n%s\n</style>\n"; 52 52 return sprintf( $style_element, $styles ); 53 53 } -
trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
r58221 r61411 332 332 $expected .= "<head>\n"; 333 333 $expected .= "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />\n"; 334 $expected .= "<style type='text/css'>body { color: black; font-family: Arial, sans-serif; font-size: 11pt; margin: 15px auto; width: 860px; }table { background: #f0f0f0; border: 1px solid #ddd; margin-bottom: 20px; width: 100%; }th { padding: 5px; text-align: left; width: 20%; }td { padding: 5px; }tr:nth-child(odd) { background-color: #fafafa; }.return-to-top { text-align: right; }</style><title>Personal Data Export for {$request->email}</title></head>\n";334 $expected .= "<style>body { color: black; font-family: Arial, sans-serif; font-size: 11pt; margin: 15px auto; width: 860px; }table { background: #f0f0f0; border: 1px solid #ddd; margin-bottom: 20px; width: 100%; }th { padding: 5px; text-align: left; width: 20%; }td { padding: 5px; }tr:nth-child(odd) { background-color: #fafafa; }.return-to-top { text-align: right; }</style><title>Personal Data Export for {$request->email}</title></head>\n"; 335 335 $expected .= "<body>\n"; 336 336 $expected .= '<h1 id="top">Personal Data Export</h1>';
Note: See TracChangeset
for help on using the changeset viewer.