WordPress.org

Make WordPress Core

Ticket #10891: script-conditionals.diff

File script-conditionals.diff, 1011 bytes (added by jdub, 9 years ago)
  • wp-includes/class.wp-scripts.php

     
    117117                $src = add_query_arg('ver', $ver, $src);
    118118                $src = esc_url(apply_filters( 'script_loader_src', $src, $handle ));
    119119
     120                $end_cond = $tag = '';
     121                if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {
     122                        $tag .= "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n";
     123                        $end_cond = "<![endif]-->\n";
     124                }
     125
     126                $tag .= apply_filters( 'script_loader_tag', "<script type='text/javascript' src='$src'></script>\n", $handle );
     127
     128                $tag .= $end_cond;
     129
    120130                if ( $this->do_concat )
    121                         $this->print_html .= "<script type='text/javascript' src='$src'></script>\n";
     131                        $this->print_html .= $tag;
    122132                else
    123                         echo "<script type='text/javascript' src='$src'></script>\n";
     133                        echo $tag;
    124134
    125135                return true;
    126136        }