svn: /web/php/trunk/ include/header.inc js/ext/html5.js styles/workarounds.ie7.css

[email protected] (Adam Harvey)
Newsgroups php.webmaster
Message-ID <[email protected]>
aharvey                                  Mon, 10 Jan 2011 09:40:10 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=307335

Log:
Implement some of Hannes's suggestions from last week: move the IE ≤ 7
background hack out to a separate workarounds stylesheet, and use Remy Sharp's
HTML5 shim to enable IE support for HTML5 elements rather than declaring them
ad hoc in the header.

Changed paths:
    U   web/php/trunk/include/header.inc
    A   web/php/trunk/js/ext/html5.js
    A   web/php/trunk/styles/workarounds.ie7.css

Modified: web/php/trunk/include/header.inc
===================================================================
--- web/php/trunk/include/header.inc	2011-01-10 09:13:26 UTC (rev 307334)
+++ web/php/trunk/include/header.inc	2011-01-10 09:40:10 UTC (rev 307335)
@@ -37,16 +37,6 @@
  <link rel="<?php echo $rel ?>" href="<?php echo $MYSITE ?><?php echo $page ?>" />
 <?php endforeach ?>

- <!--[if IE]>
- <script type="text/javascript">
-  // Enable HTML5 elements to be styled in IE.
-  document.createElement("section");
-  document.createElement("aside");
-  document.createElement("footer");
-  document.createElement("nav");
- </script>
- <![endif]-->
-
  <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/reset.css<?php echo $v?>" media="all" />
  <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/theme.css<?php echo $v?>" media="screen" />
  <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/doc.css<?php echo $v?>" media="screen" />
@@ -54,9 +44,7 @@
  <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/dynamic.php<?php echo $v?>" media="screen" />

  <!--[if lte IE 7]>
- <style type="text/css">
-  #layout { background: white; }
- </style>
+ <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT ?>styles/workarounds.ie7.css<?php echo $v?>" media="screen" />
  <![endif]-->

  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
@@ -67,6 +55,7 @@
     document.write('<script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/jquery-ui-1.8.7.min.js"><' + '/script>');
  }
  </script>
+ <script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/ext/html5.js<?php echo $v?>"></script>
  <script type="text/javascript" src="<?php echo $STATIC_ROOT ?>js/common.js<?php echo $v?>"></script>
 <?php if (!empty($_SERVER["BASE_HREF"])): ?>
  <base href="<?php echo $_SERVER["BASE_HREF"] ?>" />

Added: web/php/trunk/js/ext/html5.js
===================================================================
--- web/php/trunk/js/ext/html5.js	                        (rev 0)
+++ web/php/trunk/js/ext/html5.js	2011-01-10 09:40:10 UTC (rev 307335)
@@ -0,0 +1,6 @@
+// html5shiv MIT @rem remysharp.com/html5-enabling-script
+// iepp v1.6.2 MIT @jon_neal iecss.com/print-protector
+/*@cc_on(function(m,c){var z="abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video";function n(d){for(var a=-1;++a<o;)d.createElement(i[a])}function p(d,a){for(var e=-1,b=d.length,j,q=[];++e<b;){j=d[e];if((a=j.media||a)!="screen")q.push(p(j.imports,a),j.cssText)}return q.join("")}var g=c.createElement("div");g.innerHTML="<z>i</z>";if(g.childNodes.length!==1){var i=z.split("|"),o=i.length,s=RegExp("(^|\\s)("+z+")",
+"gi"),t=RegExp("<(/*)("+z+")","gi"),u=RegExp("(^|[^\\n]*?\\s)("+z+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),r=c.createDocumentFragment(),k=c.documentElement;g=k.firstChild;var h=c.createElement("body"),l=c.createElement("style"),f;n(c);n(r);g.insertBefore(l,
+g.firstChild);l.media="print";m.attachEvent("onbeforeprint",function(){var d=-1,a=p(c.styleSheets,"all"),e=[],b;for(f=f||c.body;(b=u.exec(a))!=null;)e.push((b[1]+b[2]+b[3]).replace(s,"$1.iepp_$2")+b[4]);for(l.styleSheet.cssText=e.join("\n");++d<o;){a=c.getElementsByTagName(i[d]);e=a.length;for(b=-1;++b<e;)if(a[b].className.indexOf("iepp_")<0)a[b].className+=" iepp_"+i[d]}r.appendChild(f);k.appendChild(h);h.className=f.className;h.innerHTML=f.innerHTML.replace(t,"<$1font")});m.attachEvent("onafterprint",
+function(){h.innerHTML="";k.removeChild(h);k.appendChild(f);l.styleSheet.cssText=""})}})(this,document);@*/
\ No newline at end of file

Added: web/php/trunk/styles/workarounds.ie7.css
===================================================================
--- web/php/trunk/styles/workarounds.ie7.css	                        (rev 0)
+++ web/php/trunk/styles/workarounds.ie7.css	2011-01-10 09:40:10 UTC (rev 307335)
@@ -0,0 +1,3 @@
+#layout {
+    background: white;
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.