choo-shortcache
Version:
choo nanocomponent cache shortcut
1 lines • 7.68 kB
JavaScript
!function(){var e=/\n[\s]+$/,t=/^\n[\s]+/,n=/[\s]+$/,r=/^[\s]+/,a=/[\n\s]+/g,o=["a","abbr","b","bdi","bdo","br","cite","data","dfn","em","i","kbd","mark","q","rp","rt","rtc","ruby","s","amp","small","span","strong","sub","sup","time","u","var","wbr"],l=["code","pre","textarea"],s=function s(i,f){if(Array.isArray(f))for(var p,u,c=i.nodeName.toLowerCase(),h=!1,d=0,g=f.length;d<g;d++){var m=f[d];if(Array.isArray(m))s(i,m);else{("number"==typeof m||"boolean"==typeof m||"function"==typeof m||m instanceof Date||m instanceof RegExp)&&(m=m.toString());var y=i.childNodes[i.childNodes.length-1];if("string"==typeof m)h=!0,y&&"#text"===y.nodeName?y.nodeValue+=m:(m=document.createTextNode(m),i.appendChild(m),y=m),d===g-1&&(h=!1,-1===o.indexOf(c)&&-1===l.indexOf(c)?""===(p=y.nodeValue.replace(t,"").replace(n,"").replace(e,"").replace(a," "))?i.removeChild(y):y.nodeValue=p:-1===l.indexOf(c)&&(u=0===d?"":" ",p=y.nodeValue.replace(t,u).replace(r," ").replace(n,"").replace(e,"").replace(a," "),y.nodeValue=p));else if(m&&m.nodeType){h&&(h=!1,-1===o.indexOf(c)&&-1===l.indexOf(c)?""===(p=y.nodeValue.replace(t,"").replace(e,"").replace(a," "))?i.removeChild(y):y.nodeValue=p:-1===l.indexOf(c)&&(p=y.nodeValue.replace(r," ").replace(t,"").replace(e,"").replace(a," "),y.nodeValue=p));var v=m.nodeName;v&&(c=v.toLowerCase()),i.appendChild(m)}}}},i=["async","autofocus","autoplay","checked","controls","default","defaultchecked","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","novalidate","open","playsinline","readonly","required","reversed","selected"],f=["indeterminate"],p=["svg","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],u={class:"className",for:"htmlFor","http-equiv":"httpEquiv"},c=1,h=2,d=3,g=4,m=5,y=6,v=7,b=8,w=9,x=10,k=11,A=12,C=13;function O(e){return e===w||e===x}Object.prototype.hasOwnProperty;var L=RegExp("^("+["area","base","basefont","bgsound","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr","!--","animate","animateTransform","circle","cursor","desc","ellipse","feBlend","feColorMatrix","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","font-face-format","font-face-name","font-face-uri","glyph","glyphRef","hkern","image","line","missing-glyph","mpath","path","polygon","polyline","rect","set","stop","tref","use","view","vkern"].join("|")+")(?:[.#][a-zA-Z0-9\x7f-\uffff_:-]+)*$"),F={},M="http://www.w3.org/2000/svg",N="http://www.w3.org/1999/xlink",S="!--";function T(e,t,n){var r;-1!==p.indexOf(e)&&(t.namespace=M);var a=!1;if(t.namespace&&(a=t.namespace,delete t.namespace),a)r=document.createElementNS(a,e);else{if(e===S)return document.createComment(t.comment);r=document.createElement(e)}for(var o in t)if(t.hasOwnProperty(o)){var l=o.toLowerCase(),u=t[o];if("classname"===l&&(l="class",o="class"),"htmlFor"===o&&(o="for"),-1!==i.indexOf(l))if("true"===u)u=l;else if("false"===u)continue;"on"===l.slice(0,2)||-1!==f.indexOf(l)?r[o]=u:a?"xlink:href"===o?r.setAttributeNS(N,o,u):/^xmlns($|:)/i.test(o)||r.setAttributeNS(null,o,u):r.setAttribute(o,u)}return s(r,n),r}(F=function(e,t){t||(t={});var n=t.concat||function(e,t){return String(e)+String(t)};return!1!==t.attrToProp&&(e=function(e){return function(t,n,r){for(var a in n)a in u&&(n[u[a]]=n[a],delete n[a]);return e(t,n,r)}}(e)),function(a){for(var o=c,l="",s=arguments.length,i=[],f=0;f<a.length;f++)if(f<s-1){var p=arguments[f+1],u=B(a[f]),F=o;F===x&&(F=b),F===w&&(F=b),F===v&&(F=b),F===g&&(F=m),u.push([0,F,p]),i.push.apply(i,u)}else i.push.apply(i,B(a[f]));var M,N=[null,{},[]],S=[[N,-1]];for(f=0;f<i.length;f++){var T=S[S.length-1][0],G=(u=i[f])[0];if(G===h&&/^\//.test(u[1])){var V=S[S.length-1][1];S.length>1&&(S.pop(),S[S.length-1][0][2][V]=e(T[0],T[1],T[2].length?T[2]:void 0))}else if(G===h){var D=[u[1],{},[]];T[2].push(D),S.push([D,T[2].length-1])}else if(G===m||0===G&&u[1]===m){for(var E,P="";f<i.length;f++)if(i[f][0]===m)P=n(P,i[f][1]);else{if(0!==i[f][0]||i[f][1]!==m)break;if("object"!=typeof i[f][2]||P)P=n(P,i[f][2]);else for(E in i[f][2])i[f][2].hasOwnProperty(E)&&!T[1][E]&&(T[1][E]=i[f][2][E])}i[f][0]===k&&f++;for(var $=f;f<i.length;f++)if(i[f][0]===b||i[f][0]===m)T[1][P]?""===i[f][1]||(T[1][P]=n(T[1][P],i[f][1])):T[1][P]=r(i[f][1]);else{if(0!==i[f][0]||i[f][1]!==b&&i[f][1]!==m){!P.length||T[1][P]||f!==$||i[f][0]!==d&&i[f][0]!==A||(T[1][P]=P.toLowerCase()),i[f][0]===d&&f--;break}T[1][P]?""===i[f][2]||(T[1][P]=n(T[1][P],i[f][2])):T[1][P]=r(i[f][2])}}else if(G===m)T[1][u[1]]=!0;else if(0===G&&u[1]===m)T[1][u[2]]=!0;else if(G===d)M=T[0],L.test(M)&&S.length&&(V=S[S.length-1][1],S.pop(),S[S.length-1][0][2][V]=e(T[0],T[1],T[2].length?T[2]:void 0));else if(0===G&&u[1]===c)void 0===u[2]||null===u[2]?u[2]="":u[2]||(u[2]=n("",u[2])),Array.isArray(u[2][0])?T[2].push.apply(T[2],u[2]):T[2].push(u[2]);else if(G===c)T[2].push(u[1]);else if(G!==k&&G!==A)throw new Error("unhandled: "+G)}if(N[2].length>1&&/^\s*$/.test(N[2][0])&&N[2].shift(),N[2].length>2||2===N[2].length&&/\S/.test(N[2][1]))throw new Error("multiple root elements must be wrapped in an enclosing tag");return Array.isArray(N[2][0])&&"string"==typeof N[2][0][0]&&Array.isArray(N[2][0][2])&&(N[2][0]=e(N[2][0][0],N[2][0][1],N[2][0][2])),N[2][0];function B(e){var n=[];o===v&&(o=g);for(var r=0;r<e.length;r++){var a=e.charAt(r);o===c&&"<"===a?(l.length&&n.push([c,l]),l="",o=h):">"!==a||O(o)||o===C?o===C&&/-$/.test(l)&&"-"===a?(t.comments&&n.push([b,l.substr(0,l.length-1)],[d]),l="",o=c):o===h&&/^!--$/.test(l)?(t.comments&&n.push([h,l],[m,"comment"],[k]),l=a,o=C):o===c||o===C?l+=a:o===h&&"/"===a&&l.length||(o===h&&/\s/.test(a)?(n.push([h,l]),l="",o=g):o===h?l+=a:o===g&&/[^\s"'=/]/.test(a)?(o=m,l=a):o===g&&/\s/.test(a)?(l.length&&n.push([m,l]),n.push([A])):o===m&&/\s/.test(a)?(n.push([m,l]),l="",o=y):o===m&&"="===a?(n.push([m,l],[k]),l="",o=v):o===m?l+=a:o!==y&&o!==g||"="!==a?o!==y&&o!==g||/\s/.test(a)?o===v&&'"'===a?o=x:o===v&&"'"===a?o=w:o===x&&'"'===a?(n.push([b,l],[A]),l="",o=g):o===w&&"'"===a?(n.push([b,l],[A]),l="",o=g):o!==v||/\s/.test(a)?o===b&&/\s/.test(a)?(n.push([b,l],[A]),l="",o=g):o!==b&&o!==w&&o!==x||(l+=a):(o=b,r--):(n.push([A]),/[\w-]/.test(a)?(l+=a,o=m):o=g):(n.push([k]),o=v)):(o===h?n.push([h,l]):o===m?n.push([m,l]):o===b&&l.length&&n.push([b,l]),n.push([d]),l="",o=c)}return o===c&&l.length?(n.push([c,l]),l=""):o===b&&l.length?(n.push([b,l]),l=""):o===x&&l.length?(n.push([b,l]),l=""):o===w&&l.length?(n.push([b,l]),l=""):o===m&&(n.push([m,l]),l=""),n}};function r(e){return"function"==typeof e?e:"string"==typeof e?e:e&&"object"==typeof e?e:n("",e)}}(T,{comments:!0})).default=F,F.createElement=T}();