I evaluated this module for a project which requires IE 7 compatibility, but chose to use a homebrew module instead. Reasoning being, because my theme already has its own html.tpl.php it seems a little clunky to add a new variable to my theme's template, especially since that amounts to a new module dependency.

Would it be better to add the link to html5.js using drupal_add_html_head()? E.g.:

  $element = array(
    '#tag' => 'script',
    '#prefix' => '<!--[if lt IE 9]>',
    '#attributes' => array(
      'src' => '...module path...html5.js',
      'type' => 'text/javascript',
    ),
    '#suffix' => '</script><![endif]-->',
  );
  drupal_add_html_head($element, 'rbn_html5_shiv');

That way even if this module's template file isn't used, you can get the shiv right outta the box?

Comments

ericduran’s picture

hmm, I don't see why not.

I remember there was a reason why we didn't do this at 1st, but I'll look into it.

Of the top of my head here some issues that come to me:
- This is going to cause the script to be entire before the css, which isn't bad but performance wise it should be after.
- This is going to cause the script to be enter before the other script tags. This is normally not a problem if you're only using the shiv but if you're only using the shiv you might have other problems with ajax. If you notice our script has a couple of extras such as overwriting the Drupal.ajax.prototype.commands.insert function.

So yea, these are problem the reason why drupal_add_html_head my not work. But I'll double check all my theories

ericduran’s picture

Ok, well I removed the innershiv and the hack to use innershiv with drupal ajax insert method.

I guess now we can actually make this work without having to required people to change the html template.

I still don't like using the drupal_add_html_head. I wish there was another way :-( sadly we've been done this road multiple times. So we'll see.

ericduran’s picture

Priority: Normal » Major
ericduran’s picture

Category: bug » feature
ericduran’s picture

Actually I think we should just remove all this.

People should honestly be using modernizr for loading the shiv.

ericduran’s picture

Title: Use drupal_add_html_head() instead of preprocess variable? » Remove shiv, as it's outdated and has incorrect fix for ie browsers
ericduran’s picture

Status: Active » Fixed

This is now fixed.

The html5.js is no longer included in this module. Everyone should really use modernizr or include the scripts them self in they're themes html.tpl.php.

--
http://drupalcode.org/project/html5_tools.git/commit/ee994a7

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pobster’s picture

You missed a bit...

<?php

/**
 * @file
 * html5_tools module implementation to display the basic html structure of a single
 * Drupal page.
 *
 * HTML5 Tools Variables:
 * - $html5shiv: An IE conditional comment for browsers below IE9, This already 
 *   contains the conditional comment tag, so you only need to print the variable.
 *   The file contains the html5shiv, innerShiv, an a modified version of
 *   Drupal.ajax.prototype.commands.insert to process html5 elements added on the
 *   page via drupal ajax.

Pobster

seandunaway’s picture

Assigned: Unassigned » seandunaway
Status: Closed (fixed) » Active

For your consideration :)

I think the simple shiv *should* be optionally included via this module.

Perhaps a simple radio option on the settings page (None, Google's, or Local). Additionally we could add a description/link for modernizr.

This is *the* html5 module, which "html5izes Drupal core" - surely the globally accepted required shiv should be included as an option so it just works :)

HTML5 is already scary enough to implement for many users, I'd hate for them to get this module and not be familiar with how to make it work a very real market share. Also, for people like me, who don't find modernizr all that particularly helpful, when we have conditional styles and doctype declarations at the top of every theme, and who don't care to use the modernizr module, to download the nearly empty customized package with shiv only, and install and configure with libraries module dependency, etc.

If you're open to this let me know I can roll a patch today.

rupl’s picture

Additionally we could add a description/link for modernizr.

Absolutely not, please do not put Modernizr in this module.

I am doing great things over at http://drupal.org/project/modernizr if I may say so myself. Check out the 7.x-3.x branch. Things are much improved over older versions. html5_tools could even integrate with the Modernizr module to keep the shiv out of your Modernizr build if you have html5_tools enabled. I'll write the hook for html5_tools if needed, it's no sweat!

seandunaway’s picture

rupl, I meant link to your module. :)

rupl’s picture

Ah my mistake!

My offer still stands to write the html5_tools integration for the Modernizr Drupal API once we get to a more stable release.

ericduran’s picture

Well what I do is just include the shiv in the modernizr build and it's honestly what most people should be doing.

Which is one of the reasons why we got rid of it from here.

I'm more than happy to make it conditional. But I really think we should just push people to use modernizr instead and include the shiv in it.

ericduran’s picture

Also another reason is that is mis-leading. Because technically we can't force it on other people if they're using a custom theme.

This really has to be a conscious effort on the developer/themer.

seandunaway’s picture

Status: Active » Fixed

ericduran made some valid points on IRC and convinced me. :)

Restoring the status that I disrupted. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.