lighty
Version:
The tiny engine for your handy microframework
4 lines (3 loc) • 1.8 kB
JavaScript
/*! lighty v0.9.0 | https://github.com/demiazz/lighty | (c) Alexey Plutalov | MIT license */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("lighty",t):e.lighty=t()}(this,function(){"use strict";function e(e,t){return l.call(e,t)}function t(e){return e.filter(function(e){return e instanceof Element})}function n(e){return[].slice.call(e)}function r(r,o,i){var c=void 0;if(r instanceof Element)c=[r];else if(r instanceof NodeList)c=t(n(r));else if(Array.isArray(r))c=t(r);else{if("string"!=typeof r)throw new TypeError("Unsupported type of tree root");c=n(f.querySelectorAll(r))}c.forEach(function(t){e(t,o)&&i(t),n(t.querySelectorAll(o)).forEach(i)})}function o(e,t,n){var r=e[t];return!!r&&-1!==r.indexOf(n)}function i(e,t,n){var r=e[t];e[t]=r?r.concat(n):[n]}function c(e){"loading"===f.readyState?f.addEventListener("DOMContentLoaded",e):setTimeout(e,1)}function u(e,t){function n(t,n){var c=n[0],u=n[1],f=n[2];r(t,u,function(t){o(t,d,c)||(e.apply(null,[t].concat(f)),i(t,d,c))})}function u(e){if(!h)throw Error("Document is not ready yet.");var t=e||a;y.forEach(function(e){return n(t,e)})}function f(e){for(var t=y.length,r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];var c=[t,e,o];y.push(c),h&&n(a,c)}function l(){h=!0,u(),t&&t()}var d=s(),y=[],h=!1;if(!(e instanceof Function))throw new TypeError("Builder must be a function");return c(l),{component:f,vitalize:u}}var f=window.document,a=f.body,l=function(){var e=f.createElement("div");return e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector}(),s=function(){var e=-1;return function(){return"__lighty__"+(e+=1)}}();return u});
//# sourceMappingURL=lighty.min.js.map