forked from malukenho/html5.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
html5.noprint.min.js
12 lines (12 loc) · 3.53 KB
/
html5.noprint.min.js
1
2
3
4
5
6
7
8
9
10
11
12
/*!
HTML5.js 1.0.0-rc github.com/bestiejs/html5.js
HTML5 Shiv pre3.3 github.com/aFarkas/html5shiv
MIT/GPL2 licensed
*/
;(function(l,d){"use strict";function m(a){for(var c=n.length,b=a.createElement;c--;)b(n[c]);return a}function o(a,c){var b=(c||i(a.ownerDocument)).e;b.appendChild(a);b.innerHTML=""}function i(a){var c=a.documentElement,c=c.uniqueNumber||c[j]||(c[j]=v++),b=g.unknownElements;return p[c]||(p[c]={a:!b&&m(a.createDocumentFragment()),b:!b&&m(a).createElement,c:!b&&a.createDocumentFragment,d:{},e:a.createElement("div")})}function q(a){var c,a=a?"all"===a||a.all?w:a:{};if("string"==typeof a){for(var b={},
a=a.split(/[, ]+/);c=a.pop();)b[c]=!0;a=b}return a}function x(a){var c=i(a),b=c.b,f=c.a,e=c.d;a.createElement=function(a){var c=e[a],d=c?c.cloneNode():b(a);if(!c&&!k[a]&&!(k[a]=r.test(d.outerHTML)))d=(e[a]=d).cloneNode();return d.canHaveChildren&&!s.test(a)?f.appendChild(d):d};a.createDocumentFragment=Function("b","return function(){var c=b.cloneNode(),a=c.createElement;"+(n+"").replace(/\w+/g,'a("$&")')+";return c}")(f)}function t(a,c){a||(a=d);a&&!a.nodeType&&(c=a,a=d);c=q(c);if(!g.unknownElements&&
c.methods){var b=a,f=i(b),e=f.b;b.createElement!=e&&(b.createElement=e);if(b.createDocumentFragment!=(e=f.c))b.createDocumentFragment=e}!g.html5Printing&&c.print&&unsetPrintSupport(a);if(!g.html5Styles&&c.styles&&(b=i(a),f=b.sheet))b.sheet=null,o(f,b);return a}var w={methods:!0,styles:!0},p={},y=l.html5,n="abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video".split(" "),j="html5js"+/\d+$/.exec(Math.random()),
s=/^(?:button|select)$/i,r=/^<\?/,v=1,k={},g={};(function(){var a,c,b;try{b=new ActiveXObject("https:"==location.protocol&&"htmlfile")}catch(f){(b=d.createElement("iframe")).name=j,b.frameBorder=b.height=b.width=0,c=d.body||d.documentElement,c.insertBefore(b,c.firstChild),b=(b=b.contentWindow||b.contentDocument||frames[j]).document||b}b.write("<!doctypehtml><title></title><body><script>document.w=this<\/script>");b.close();a=b.body.appendChild(b.createElement("p"));a.innerHTML="<nav/>";g.html5Styles=
!!a.firstChild&&"block"==(a.firstChild.currentStyle||b.w.getComputedStyle(a.firstChild,null)).display;var e=g,h;if(!(h=1==a.childNodes.length))a:{try{d.createElement("p")}catch(i){h=!0;break a}h="undefined"==typeof d.createDocumentFragment().createElement||"undefined"==typeof a.uniqueNumber}e.unknownElements=h;c&&o(b.w.frameElement)})();var u={version:"1.0.0-rc",support:g,createDocumentFragment:function(a){a||(a=d);return g.unknownElements?a.createDocumentFragment():m(i(a).a.cloneNode())},createElement:function(a,
c){a||(a=d);a&&!a.nodeType&&(c=a,a=d);if(g.unknownElements)return a.createElement(c);var b=i(a),f=b.d,e=f[c],h=e?e.cloneNode():b.b(c);if(!e&&!k[c]&&!(k[c]=r.test(h.outerHTML)))h=(f[c]=h).cloneNode();return h.canHaveChildren&&!s.test(c)?b.a.appendChild(h):h},install:function(a,c){a||(a=d);a&&!a.nodeType&&(c=a,a=d);c=q(c);t(a,{methods:c.methods,print:c.print,styles:c.styles});if(!g.html5Styles&&c.styles){var b=a,f=i(b),e;e=b.createElement("p");b=b.getElementsByTagName("head")[0]||b.documentElement;
e.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#ff0;color:#000}</style>";e=b.insertBefore(e.lastChild,b.firstChild);f.sheet=e}g.unknownElements||(c.methods?x(a):i(a));return a},noConflict:function(){l.html5=y;return this},uninstall:t};l.html5=u;typeof define=="function"&&typeof define.amd=="object"&&define.amd&&define(function(){return u})})(this,document);