How to add conditional javascript to theme? I'd like to use Selectivizr script to emulate CSS3 selectors in IE6-8. 

But I'm having a hard time adding it to my theme. So far tried:

1) Forcing this into html.tpl.php head section:

&lt;!--[if lt IE 9]&gt;
&lt;script src="&lt;?php print base_path() . path_to_theme(); ?&gt;/js/selectivizr.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;


But base_path() doesn't seem to return anything in D7 (at least in html.tpl.php - maybe in page.tpl.php...). And I know this isn't the Drupal way to do it anyway.

2) Adding to my theme's .info file:

scripts[] = selectivizr.js


But then it's unconditional, of course :(

3) Using drupal_add_js() in my template.php. 

But again, I'm not sure that it can be set conditionally there?
This is how I've added html5shiv in my template.php file:

$html5shiv = array(
  '#tag' =&gt; 'script',
  '#attributes' =&gt; array( // Set up an array of attributes inside the tag
    'src' =&gt; drupal_get_path('theme', 'mythemename') . '/js/lib/html5shiv.js', 
  ),
  '#prefix' =&gt; '&lt;!--[if lte IE 8]&gt;',
  '#suffix' =&gt; '&lt;/script&gt;&lt;![endif]--&gt;',
);
drupal_add_html_head($html5shiv, 'html5shiv');