com web/php: Implement some of Hannes's suggestions from last week: move the IE ≤ 7 background hack out to a sep arate workarounds stylesheet, and
use Remy Sharp 's HTML5 shim to enable IE support for HTML 5 elements rather than declaring them ad hoc in the header.: include/header.inc
js/ext/html5 .js styles/workarounds.ie7.css
| From: | Paul Dragoonis | Date: | Mon, 10 Jan 2011 09:40:10 +0000 |
| Subject: | com web/php: Implement some of Hannes's suggestions from last week: move the IE ≤ 7 background hack out to a sep arate workarounds stylesheet, and use Remy Sharp 's HTML5 shim to enable IE support for HTML 5 elements rather than declaring them ad hoc in the header.: include/header.inc js/ext/html5 .js styles/workarounds.ie7.css |
||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-23613@lists.php.net to get a copy of this message | ||
Commit: 64cb8c3038a2b5462c072ea07ac642db7177c300
Author: Adam Harvey <aharvey@php.net> Mon, 10 Jan 2011 09:40:10 +0000
Parents: 1281523559ccb6e9f61b96fbd30598ac112c46cf
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=64cb8c3038a2b5462c072ea07ac642db7177c300
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:
M include/header.inc
A js/ext/html5.js
A styles/workarounds.ie7.css
Diff:
diff --git a/include/header.inc b/include/header.inc
index b1cbb6e..af1042b 100644
--- a/include/header.inc
+++ b/include/header.inc
@@ -37,16 +37,6 @@ if (isset($shortname) && $shortname) {
<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 @@ if (isset($shortname) && $shortname) {
<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 @@ if (isset($shortname) && $shortname) {
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"] ?>" />
diff --git a/js/ext/html5.js b/js/ext/html5.js
new file mode 100644
index 0000000..3587bf7
--- /dev/null
+++ b/js/ext/html5.js
@@ -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
diff --git a/styles/workarounds.ie7.css b/styles/workarounds.ie7.css
new file mode 100644
index 0000000..51abec6
--- /dev/null
+++ b/styles/workarounds.ie7.css
@@ -0,0 +1,3 @@
+#layout {
+ background: white;
+}