Index: wp-includes/class.wp-scripts.php
===================================================================
--- wp-includes/class.wp-scripts.php (revision 21548)
+++ wp-includes/class.wp-scripts.php (working copy)
@@ -96,7 +96,7 @@
$src = $this->registered[$handle]->src;
- if ( $this->do_concat ) {
+ if ( $this->do_concat && ( !isset($this->registered[$handle]->extra['conditional']) || !$this->registered[$handle]->extra['conditional'] ) ) {
$srce = apply_filters( 'script_loader_src', $src, $handle );
if ( $this->in_default_dir($srce) ) {
$this->print_code .= $this->print_extra_script( $handle, false );
@@ -119,11 +119,45 @@
$src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
- if ( $this->do_concat )
+ if ( $this->do_concat && ( !isset( $this->registered[$handle]->extra['conditional'] ) || !$this->registered[$handle]->extra['conditional'] ) ) {
$this->print_html .= "\n";
- else
- echo "\n";
+ } else {
+ $start_cond = $end_cond = '';
+ if ( isset( $this->registered[$handle]->extra['conditional'] ) && $this->registered[$handle]->extra['conditional'] ) {
+ // By default, assume the conditional will target IE
+ $target_ie = true;
+
+ // If an array is passed in the conditional parameter, extract conditional and browser target
+ if ( is_array( $this->registered[$handle]->extra['conditional'] ) ) {
+ if ( isset( $this->registered[$handle]->extra['conditional']['condition'] ) ) {
+ $target_ie = isset( $this->registered[$handle]->extra['conditional']['target_ie'] ) ? (bool) $this->registered[$handle]->extra['conditional']['target_ie'] : true;
+
+ $this->registered[$handle]->extra['conditional'] = $this->registered[$handle]->extra['conditional']['condition'];
+ }
+ else {
+ $this->registered[$handle]->extra['conditional'] = '';
+ }
+ }
+
+ // Build the conditional, including the non-IE comment if necessary.
+ $start_cond = "';
+
+ $start_cond .= "\n";
+
+ $end_cond = "\n";
+
+ // Fail gracefully if the user doesn't pass the right data
+ if ( empty( $this->registered[$handle]->extra['conditional'] ) )
+ $start_cond = $end_cond = '';
+ }
+
+ echo "{$start_cond}\n{$end_cond}";
+ }
+
return true;
}