Index: src/wp-content/themes/twentytwelve/functions.php
===================================================================
--- src/wp-content/themes/twentytwelve/functions.php (revision 30985)
+++ src/wp-content/themes/twentytwelve/functions.php (working copy)
@@ -133,6 +133,12 @@
global $wp_styles;
/*
+ * Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions.
+ */
+ wp_enqueue_script( 'twentytwelve-html5', get_template_directory_uri() . '/js/html5.js', array(), '1.0' );
+ wp_script_add_data( 'twentytwelve-html5', 'conditional', 'lt IE 9' );
+
+ /*
* Adds JavaScript to pages with the comment form to support
* sites with threaded comments (when in use).
*/
@@ -151,7 +157,7 @@
// Loads the Internet Explorer specific stylesheet.
wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' );
- $wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );
+ wp_style_add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );
}
add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' );
Index: src/wp-content/themes/twentytwelve/header.php
===================================================================
--- src/wp-content/themes/twentytwelve/header.php (revision 30985)
+++ src/wp-content/themes/twentytwelve/header.php (working copy)
@@ -24,10 +24,6 @@
-
-
Index: src/wp-includes/class.wp-scripts.php
===================================================================
--- src/wp-includes/class.wp-scripts.php (revision 30985)
+++ src/wp-includes/class.wp-scripts.php (working copy)
@@ -95,16 +95,25 @@
if ( false === $group && in_array($handle, $this->in_footer, true) )
$this->in_footer = array_diff( $this->in_footer, (array) $handle );
- if ( null === $this->registered[$handle]->ver )
+ $obj = $this->registered[$handle];
+
+ if ( null === $obj->ver )
$ver = '';
else
- $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
+ $ver = $obj->ver ? $obj->ver : $this->default_version;
if ( isset($this->args[$handle]) )
$ver = $ver ? $ver . '&' . $this->args[$handle] : $this->args[$handle];
- $src = $this->registered[$handle]->src;
+ $src = $obj->src;
+ $cond_before = $cond_after = '';
+ $conditional = isset( $obj->extra['conditional'] ) ? $obj->extra['conditional'] : '';
+ if ( $conditional ) {
+ $cond_before = "";
+ }
+
if ( $this->do_concat ) {
/**
* Filter the script loader source.
@@ -115,7 +124,7 @@
* @param string $handle Script handle.
*/
$srce = apply_filters( 'script_loader_src', $src, $handle );
- if ( $this->in_default_dir($srce) ) {
+ if ( $this->in_default_dir( $srce ) && ! $conditional ) {
$this->print_code .= $this->print_extra_script( $handle, false );
$this->concat .= "$handle,";
$this->concat_version .= "$handle$ver";
@@ -140,7 +149,7 @@
if ( ! $src )
return true;
- $tag = "\n";
+ $tag = "{$cond_before}{$cond_after}\n";
/**
* Filter the HTML script tag of an enqueued script.
Index: src/wp-includes/functions.wp-scripts.php
===================================================================
--- src/wp-includes/functions.wp-scripts.php (revision 30985)
+++ src/wp-includes/functions.wp-scripts.php (working copy)
@@ -258,3 +258,26 @@
return (bool) $wp_scripts->query( $handle, $list );
}
+
+
+/**
+ * Add metadata to a script.
+ *
+ * Works only if the script has already been added.
+ *
+ * Possible values for $key and $value:
+ * 'conditional' string Comments for IE 6, lte IE 7, etc.
+ *
+ * @see WP_Dependency::add_data()
+ *
+ * @since 4.2.0
+ *
+ * @param string $handle Name of the script.
+ * @param string $key Name of data point for which we're storing a value.
+ * @param mixed $value String containing the data to be added.
+ * @return bool True on success, false on failure.
+ */
+function wp_script_add_data( $handle, $key, $value ){
+ global $wp_scripts;
+ return $wp_scripts->add_data( $handle, $key, $value );
+}