UNPKG

node-tailor

Version:

Tailor assembles a web page from multiple fragments

2 lines 1.38 kB
var Pipe=function(e){return function(n){function t(){for(var e,n=l.length-1;n>=0;n--)if(e=l[n],e.hasAttribute("data-pipe"))return e.removeAttribute("data-pipe"),e}function i(e){d[e]=t()}function o(e,i){f[e]=t(),i&&n([i])}function r(e,i){var o,r=d[e],a=f[e],l=t(),u=a;if(r){do o=u,u=u.nextSibling,r.parentNode.insertBefore(o,r);while(o!==l);r.parentNode.removeChild(r)}for(o=a.nextSibling;o&&1!==o.nodeType;)o=o.nextSibling;o===l&&(o=void 0),a.parentNode.removeChild(a),l.parentNode.removeChild(l),i&&n([i],function(e){var n=e&&e.__esModule?e["default"]:e;"function"==typeof n&&n(o)})}/* @preserve - loadCSS: load a CSS file asynchronously. [c]2016 @scottjehl, Filament Group, Inc. Licensed MIT */ function a(n){function t(n){return e.body?n():void setTimeout(function(){t(n)})}var i,o=e.createElement("link"),r="all",a=(e.body||e.getElementsByTagName("head")[0]).childNodes;i=a[a.length-1];var d=e.styleSheets;o.rel="stylesheet",o.href=n,o.media="only x",t(function(){i.parentNode.insertBefore(o,i.nextSibling)});var f=function(e){for(var n=o.href,t=d.length;t--;)if(d[t].href===n)return e();setTimeout(function(){f(e)})};return o.addEventListener&&o.addEventListener("load",function(){this.media=r}),o.onloadcssdefined=f,f(function(){o.media!==r&&(o.media=r)}),o}var d={},f={},l=e.getElementsByTagName("script");return{placeholder:i,start:o,end:r,loadCSS:a}}}(window.document);