Changeset 56687 for trunk/src/wp-includes/script-loader.php
- Timestamp:
- 09/25/2023 09:03:19 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-loader.php
r56646 r56687 2788 2788 function wp_get_script_tag( $attributes ) { 2789 2789 if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) { 2790 $attributes['type'] = 'text/javascript'; 2790 // Keep the type attribute as the first for legacy reasons (it has always been this way in core). 2791 $attributes = array_merge( 2792 array( 'type' => 'text/javascript' ), 2793 $attributes 2794 ); 2791 2795 } 2792 2796 /** … … 2831 2835 */ 2832 2836 function wp_get_inline_script_tag( $javascript, $attributes = array() ) { 2833 if ( ! isset( $attributes['type'] ) && ! is_admin() && ! current_theme_supports( 'html5', 'script' ) ) { 2834 $attributes['type'] = 'text/javascript'; 2835 } 2837 $is_html5 = current_theme_supports( 'html5', 'script' ) || is_admin(); 2838 if ( ! isset( $attributes['type'] ) && ! $is_html5 ) { 2839 // Keep the type attribute as the first for legacy reasons (it has always been this way in core). 2840 $attributes = array_merge( 2841 array( 'type' => 'text/javascript' ), 2842 $attributes 2843 ); 2844 } 2845 2846 // Ensure markup is XHTML compatible if not HTML5. 2847 if ( ! $is_html5 ) { 2848 $javascript = str_replace( ']]>', ']]]]><![CDATA[>', $javascript ); // Escape any existing CDATA section. 2849 $javascript = sprintf( "/* <![CDATA[ */\n%s\n/* ]]> */", $javascript ); 2850 } 2851 2852 $javascript = "\n" . trim( $javascript, "\n\r " ) . "\n"; 2853 2836 2854 /** 2837 2855 * Filters attributes to be added to a script tag. … … 2845 2863 */ 2846 2864 $attributes = apply_filters( 'wp_inline_script_attributes', $attributes, $javascript ); 2847 2848 $javascript = "\n" . trim( $javascript, "\n\r " ) . "\n";2849 2865 2850 2866 return sprintf( "<script%s>%s</script>\n", wp_sanitize_script_attributes( $attributes ), $javascript );
Note: See TracChangeset
for help on using the changeset viewer.