-
Notifications
You must be signed in to change notification settings - Fork 1
/
concat.min.js
5 lines (5 loc) · 2.89 KB
/
concat.min.js
1
2
3
4
5
/*!
* concat.js v1.0.0, https://github.com/hoho/concat.js
* (c) 2013-2017 Marat Abdullin, MIT license
*/
!function(a,b,c){"object"==typeof module&&"object"==typeof module.exports?(b=a(require,exports),b!==c&&(module.exports=b)):"function"==typeof define&&define.amd?define("concatjs",["require","exports"],a):(a(c,b={}),this.$C=b.$C)}(function(a,b){"use strict";var c,d,e,f=void 0,g=document,h="div|span|p|a|ul|ol|li|table|tr|td|th|br|img|b|i|s|u".split("|"),i=[],j=function(a){return"function"==typeof a},k=function(a,b,c){var d=this;d._=d.c={D:a&&{p:a,r:b},P:a&&(d.d=c)?a:g.createDocumentFragment(),_:[]}},l=function(a){var b,c,d,g,h=i,k=e,m=-1;if(a.E!==f){if(e=j(a.E)?a.E.apply(a.A.P,i):a.E){if(g=[],e instanceof Array)for(d=0;d<e.length;d++)g.push(d);else for(d in e)g.push(d);i=[f,f,e],b=function(){return i[0]=e[i[1]=g[++m]],m<g.length}}}else a.R!==f?(i=[-1],e=f,b=function(){return j(a.R)?a.R.call(a.A.P,++i[0]):++i[0]<a.R}):c=j(a.T)?a.T.apply(a.A.P,i)?1:0:a.T===f||a.T?1:0;for(;!b&&c--||b&&b();)for((b||a.T)&&(a.P=a.A.P),a.F&&a.F(),d=0;d<a._.length;d++)l(a._[d]);i=h,e=k},m=function(a,b,c){return c={A:a.c,F:b,_:[]},a.c._.push(c),c},n=function(a,b){return function(c){var d=this,e=m(d);return e[a]=c===f?b:c,d.c=e,d}};for(c=k.prototype,c.end=function(a){var b,c,e=this;for(a===f&&(a=1);a>0&&(c=e.c.e,e.c=e.c.A);)a--;return e.c?c||e:(b=e._,l(b),(d=b.D)?(d.r&&(d.p.innerHTML=""),void(e.d||d.p.appendChild(b.P))):b.P)},c.elem=function(a,b,c){var d=this,e=m(d,function(c,d,h,k,l,m){c=e.P=g.createElement(j(a)?a.apply(e.A.P,i):a),m=j(b)?b.apply(c,i):b;for(var n in m)if(j(d=m[n])&&(d=d.apply(c,i)),d!==f)if("style"===n){if("object"==typeof d){k=[];for(h in d)j(l=d[h])&&(l=l.apply(c,i)),l!==f&&k.push(h+": "+l);d=k.join("; ")}d&&(c.style.cssText=d)}else c.setAttribute(n,d);e.A.P.appendChild(c)});return d.c=e,c||c===f&&b===!0?d.end():d},c.mem=function(a,c){var d=this,e=m(d,function(d){d=e.A.P,b.$C.mem[j(a)?a.apply(d,i):a]=j(c)?c.apply(d,i):c||d});return d},c.repeat=n("R",0),c.each=n("E",[]),c.test=n("T",!1),c.choose=function(){var a,b=this,d=m(b,function(){a=f}),e={},g=function(c,f){return function(g){return f=n("T").call(b,function(){return!(a||!(c||(j(g)?g.apply(d.A.P,i):g)))&&(a=!0)}),f.c.e=e,f}};return d.T=!0,b.c=d,e.when=g(),e.otherwise=g(!0),e.end=function(a){return c.end.call(b,a)},e},d=0;d<h.length;d++)c[h[d]]=function(a){return function(b,c){return this.elem(a,b,c)}}(h[d]);b.$C=d=function(a,b,c){return new k(a,b,c)},d.mem={},d.define=d=function(a,b){c[a]=function(){var a=arguments,c=m(this,function(){b.call(c.A.P,i[0],i[1],i[2],a)});return this}},d("act",function(a,b,c,d){d[0].apply(this,i)}),d("text",function(a,b,c,d,e,h){if(e=d[0],e=j(e)?e.apply(this,i):e,e!==f)if(d[1])for(h=g.createElement("p"),h.innerHTML=e,h=h.firstChild;h;)e=h.nextSibling,this.appendChild(h),h=e;else this.appendChild(g.createTextNode(e))}),d("attr",function(a,b,c,d,e,f,g){(e=this).setAttribute(j(f=d[0])?f.call(e,a,b,c):f,j(g=d[1])?g.call(e,a,b,c):g)})});