From 04f50d9e2081860f0de2fcb6412e9d0ff91b9bbe Mon Sep 17 00:00:00 2001
From: Mark Trapp <mark@marktrapp.com>
Date: Tue, 24 May 2011 12:33:17 -0700
Subject: [PATCH] Issue #1077878: Add HTML5shim to core

---
 modules/html5/html5.info        |    5 +++++
 modules/html5/html5.js          |    3 +++
 modules/html5/html5.module      |   32 ++++++++++++++++++++++++++++++++
 profiles/standard/standard.info |    1 +
 4 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 modules/html5/html5.info
 create mode 100644 modules/html5/html5.js
 create mode 100644 modules/html5/html5.module

diff --git a/modules/html5/html5.info b/modules/html5/html5.info
new file mode 100644
index 0000000..92742f4
--- /dev/null
+++ b/modules/html5/html5.info
@@ -0,0 +1,5 @@
+name = HTML5 legacy support
+description = Enables HTML5 support in legacy browsers.
+package = Core
+version = VERSION
+core = 8.x
\ No newline at end of file
diff --git a/modules/html5/html5.js b/modules/html5/html5.js
new file mode 100644
index 0000000..6dd03a4
--- /dev/null
+++ b/modules/html5/html5.js
@@ -0,0 +1,3 @@
+// html5shiv MIT @rem remysharp.com/html5-enabling-script
+// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector
+/*@cc_on(function(a,b){function r(a){var b=-1;while(++b<f)a.createElement(e[b])}if(!(!window.attachEvent||!b.createStyleSheet||!function(){var a=document.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1}())){a.iepp=a.iepp||{};var c=a.iepp,d=c.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",e=d.split("|"),f=e.length,g=new RegExp("(^|\\s)("+d+")","gi"),h=new RegExp("<(/*)("+d+")","gi"),i=/^\s*[\{\}]\s*$/,j=new RegExp("(^|[^\\n]*?\\s)("+d+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),k=b.createDocumentFragment(),l=b.documentElement,m=l.firstChild,n=b.createElement("body"),o=b.createElement("style"),p=/print|all/,q;c.getCSS=function(a,b){if(a+""===undefined)return"";var d=-1,e=a.length,f,g=[];while(++d<e){f=a[d];if(f.disabled)continue;b=f.media||b,p.test(b)&&g.push(c.getCSS(f.imports,b),f.cssText),b="all"}return g.join("")},c.parseCSS=function(a){var b=[],c;while((c=j.exec(a))!=null)b.push(((i.exec(c[1])?"\n":c[1])+c[2]+c[3]).replace(g,"$1.iepp_$2")+c[4]);return b.join("\n")},c.writeHTML=function(){var a=-1;q=q||b.body;while(++a<f){var c=b.getElementsByTagName(e[a]),d=c.length,g=-1;while(++g<d)c[g].className.indexOf("iepp_")<0&&(c[g].className+=" iepp_"+e[a])}k.appendChild(q),l.appendChild(n),n.className=q.className,n.id=q.id,n.innerHTML=q.innerHTML.replace(h,"<$1font")},c._beforePrint=function(){o.styleSheet.cssText=c.parseCSS(c.getCSS(b.styleSheets,"all")),c.writeHTML()},c.restoreHTML=function(){n.innerHTML="",l.removeChild(n),l.appendChild(q)},c._afterPrint=function(){c.restoreHTML(),o.styleSheet.cssText=""},r(b),r(k);if(c.disablePP)return;m.insertBefore(o,m.firstChild),o.media="print",o.className="iepp-printshim",a.attachEvent("onbeforeprint",c._beforePrint),a.attachEvent("onafterprint",c._afterPrint)}})(this,document)@*/
\ No newline at end of file
diff --git a/modules/html5/html5.module b/modules/html5/html5.module
new file mode 100644
index 0000000..9af3d4a
--- /dev/null
+++ b/modules/html5/html5.module
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @file
+ * Enables HTML5 support in legacy browsers.
+ */
+
+/**
+ * Implements hook_init().
+ */
+function html5_init() {
+  drupal_add_library('html5', 'shim');
+}
+
+/**
+ * Implements hook_library().
+ */
+function html5_library() {
+  $module_path = drupal_get_path('module', 'html5');
+
+  // HTML5 shiv.
+  $libraries['shim'] = array(
+    'title' => 'HTML5shim',
+    'website' => 'http://code.google.com/p/html5shim/',
+    'version' => 'trunk',
+    'js' => array(
+      $module_path . '/html5.js' => array(),
+    ),
+  );
+
+  return $libraries;
+}
diff --git a/profiles/standard/standard.info b/profiles/standard/standard.info
index 56e4308..b8c1e1a 100644
--- a/profiles/standard/standard.info
+++ b/profiles/standard/standard.info
@@ -8,6 +8,7 @@ dependencies[] = comment
 dependencies[] = contextual
 dependencies[] = dashboard
 dependencies[] = help
+dependencies[] = html5
 dependencies[] = image
 dependencies[] = list
 dependencies[] = menu
-- 
1.7.4.1

