Ticket #16024: 16024.6.diff
File 16024.6.diff, 4.6 KB (added by , 9 years ago) |
---|
-
src/wp-content/themes/twentytwelve/functions.php
133 133 global $wp_styles; 134 134 135 135 /* 136 * Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. 137 */ 138 wp_enqueue_script( 'twentytwelve-html5', get_template_directory_uri() . '/js/html5.js', array(), '1.0' ); 139 wp_script_add_data( 'twentytwelve-html5', 'conditional', 'lt IE 9' ); 140 141 /* 136 142 * Adds JavaScript to pages with the comment form to support 137 143 * sites with threaded comments (when in use). 138 144 */ … … 151 157 152 158 // Loads the Internet Explorer specific stylesheet. 153 159 wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' ); 154 $wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );160 wp_style_add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' ); 155 161 } 156 162 add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' ); 157 163 -
src/wp-content/themes/twentytwelve/header.php
24 24 <title><?php wp_title( '|', true, 'right' ); ?></title> 25 25 <link rel="profile" href="http://gmpg.org/xfn/11" /> 26 26 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 27 <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>28 <!--[if lt IE 9]>29 <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>30 <![endif]-->31 27 <?php wp_head(); ?> 32 28 </head> 33 29 -
src/wp-includes/class.wp-scripts.php
95 95 if ( false === $group && in_array($handle, $this->in_footer, true) ) 96 96 $this->in_footer = array_diff( $this->in_footer, (array) $handle ); 97 97 98 if ( null === $this->registered[$handle]->ver ) 98 $obj = $this->registered[$handle]; 99 100 if ( null === $obj->ver ) 99 101 $ver = ''; 100 102 else 101 $ver = $ this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;103 $ver = $obj->ver ? $obj->ver : $this->default_version; 102 104 103 105 if ( isset($this->args[$handle]) ) 104 106 $ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle]; 105 107 106 $src = $this->registered[$handle]->src; 108 $src = $obj->src; 109 $cond_before = $cond_after = ''; 110 $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : ''; 107 111 112 if ( $conditional ) { 113 $cond_before = "<!--[if {$conditional}]>\n"; 114 $cond_after = "\n<![endif]-->"; 115 } 116 108 117 if ( $this->do_concat ) { 109 118 /** 110 119 * Filter the script loader source. … … 115 124 * @param string $handle Script handle. 116 125 */ 117 126 $srce = apply_filters( 'script_loader_src', $src, $handle ); 118 if ( $this->in_default_dir( $srce)) {127 if ( $this->in_default_dir( $srce ) && ! $conditional ) { 119 128 $this->print_code .= $this->print_extra_script( $handle, false ); 120 129 $this->concat .= "$handle,"; 121 130 $this->concat_version .= "$handle$ver"; … … 140 149 if ( ! $src ) 141 150 return true; 142 151 143 $tag = " <script type='text/javascript' src='$src'></script>\n";152 $tag = "{$cond_before}<script type='text/javascript' src='$src'></script>{$cond_after}\n"; 144 153 145 154 /** 146 155 * Filter the HTML script tag of an enqueued script. -
src/wp-includes/functions.wp-scripts.php
258 258 259 259 return (bool) $wp_scripts->query( $handle, $list ); 260 260 } 261 262 263 /** 264 * Add metadata to a script. 265 * 266 * Works only if the script has already been added. 267 * 268 * Possible values for $key and $value: 269 * 'conditional' string Comments for IE 6, lte IE 7, etc. 270 * 271 * @see WP_Dependency::add_data() 272 * 273 * @since 4.2.0 274 * 275 * @param string $handle Name of the script. 276 * @param string $key Name of data point for which we're storing a value. 277 * @param mixed $value String containing the data to be added. 278 * @return bool True on success, false on failure. 279 */ 280 function wp_script_add_data( $handle, $key, $value ){ 281 global $wp_scripts; 282 return $wp_scripts->add_data( $handle, $key, $value ); 283 }