Created
January 4, 2016 02:23
-
-
Save eporroa/a014685663cca12d9f2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<meta name="robots" content="noindex, nofollow"> | |
<meta name="googlebot" content="noindex, nofollow"> | |
<script type="text/javascript" src="/js/lib/dummy.js"></script> | |
<link rel="stylesheet" type="text/css" href="/css/result-light.css"> | |
<style type="text/css"> | |
template { | |
display: none !important; | |
} | |
</style> | |
<title><template> Polyfill by brianblakely</title> | |
</head> | |
<body> | |
<script> | |
// Shim so we can style in IE6/7/8 | |
document.createElement('template'); | |
</script> | |
<template id="example"> | |
<h1> | |
This is template content. | |
</h1> | |
<p> | |
It's really great. | |
</p> | |
</template> | |
<div id="target"> | |
<p> | |
This is regular old content. | |
</p> | |
</div> | |
<script type='text/javascript'>//<![CDATA[ | |
/* POLYFILL */ | |
(function templatePolyfill(d) { | |
if('content' in d.createElement('template')) { | |
return false; | |
} | |
var qPlates = d.getElementsByTagName('template'), | |
plateLen = qPlates.length, | |
elPlate, | |
qContent, | |
contentLen, | |
docContent; | |
for(var x=0; x<plateLen; ++x) { | |
elPlate = qPlates[x]; | |
qContent = elPlate.childNodes; | |
contentLen = qContent.length; | |
docContent = d.createDocumentFragment(); | |
while(qContent[0]) { | |
docContent.appendChild(qContent[0]); | |
} | |
elPlate.content = docContent; | |
} | |
})(document); | |
/* EXAMPLE */ | |
var elExample = document.getElementById('example'), | |
elTarget = document.getElementById('target'); | |
elTarget.appendChild(elExample.content.cloneNode(true)); | |
//]]> | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment