elements-lite
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -1,17 +0,17 @@ | ||
!function(w,l,h){function I(a,b,d){for(var g=[],r=a.firstChild,c=J(b);b=r;){if(c(b)){if(d)return b;g.push(b)}for(r=b.firstChild||b.nextSibling;!r&&(b=b.parentNode)!==a;)r=b.nextSibling}return d?null:g}function J(a){return K[a]||(K[a]=Function("_,v,a,b","return "+a.split(ba).map(function(a){var d,g,c=["_&&_.nodeType==1"],f=a.replace(ca,function(a,b,c,r){g=r+b.length;d=b.trim();return""});(a=a.slice(g).replace(L,function(a,b,d,g,f,A,e){c.push("((v='"+(g||(e?A.slice(1,-1):A)||"").replace(/'/g,"\\'")+ | ||
"'),(a='"+d+"'),1)",M[":"==b?d:b]||"(a=_.getAttribute(a))"+(f?"&&"+M[f]:A?"==v":""));return""}))&&"*"!=a&&(c[0]+="&&_.nodeName=='"+a.toUpperCase()+"'");f&&c.push("+"==d?"(a=_.previousSibling)":"(a=_.parentNode)",(d?"a.matches&&a.matches('":"a.closest&&a.closest('")+f+"')");return c.join("&&")}).join("||")))}function f(a,b,d){var g={};a=a.replace(L,function(a,b,d,c,f,e,k){e=k?e.slice(1,-1):e||d;g[b="."==b?(f="~","class"):"#"==b?"id":d]=f&&g[b]?"^"==f?e+g[b]:g[b]+("~"==f?" ":"")+e:e;return""})||"div"; | ||
a=(B[a]||(B[a]=l.createElement(a))).cloneNode(!0).attr(g);return d||!b?a:("object"==typeof b?k:x).call(a,b)}function x(a,b){var d,g=0,c=typeof a;if(a){if("string"==c||"number"==c)a=l.createTextNode(a);else if(!("nodeType"in a)&&"length"in a){c=a.length;for(d=l.createDocumentFragment();g<c;)x.call(d,a[g++]);a=d}a.nodeType&&(c=this.insertBefore?this:this[this.length-1],c.insertBefore(a,(!0===b?c.firstChild:"number"==typeof b?c.childNodes[0>b?c.childNodes.length-b-2:b]:b)||null))}return this}function y(a){return-1< | ||
this.className.split(/\s+/).indexOf(a)}function C(a){var b=this.className;b&&(a=y.call(this,a)?b:b+" "+a);b!=a&&(this.className=a);return this}function N(a){y.call(this,a)&&(this.className=(" "+this.className+" ").replace(" "+a+" "," ").trim());return this}function O(a,b){1==arguments.length&&(b=!y.call(this,a));return(b?C:N).call(this,a),b}function P(){var a;this.emit&&this.emit("kill");this.parentNode&&this.parentNode.removeChild(this);Event.removeAll&&Event.removeAll(this);this.empty&&this.empty(); | ||
(a=this.attr&&this.attr("data-scope"))&&delete p[a];this.valObject&&(this.valObject=null);return this}function k(a,b){var d;if(a&&a.constructor==Object){for(b in a)k.call(this,b,a[b]);return this}d=this.getAttribute(a);if(1==arguments.length)return d;!da||"id"!=a&&"name"!=a&&"checked"!=a?"class"==a?C.call(this,b):b||0===b?d!=b&&this.setAttribute(a,b):d&&this.removeAttribute(a):this.mergeAttributes(Q("<INPUT "+a+'="'+b+'">'),!1)}function p(a,b,d){if(d=p[k.call(a,"data-scope")])return d;b&&!0!==b|| | ||
(d=(d=R.call(a,"[data-scope]"))&&p[k.call(d,"data-scope")]||S);b&&(k.call(a,"data-scope",++T),d=p[T]=Object.create(b=d||b),d._super=b);return d}function U(a,b){var d,c,f;if(1!=this.nodeType)return this;a=p[k.call(this,"data-scope")]||a||(d=R.call(this,"[data-scope]"))&&p[k.call(d,"data-scope")]||S;if(d=!b&&k.call(this,"data-bind")){c=d;f="data b r->data&&("+d.replace(ea,function(a,b,d){return q[b]?(fa.call(q[b],"once")&&(c=c.replace(a,"")),"(r=b['"+b+"'].call(this,"+(q[b].raw?"data,'"+d+"'":d)+")||r),"): | ||
"this.attr('"+b+"',"+d+"),"})+"r)";d!=c&&k.call(this,"data-bind",c);try{if(Fn(f,this,a)(a,q))return this}catch(e){e.message+=" in binding: "+d;console.error(e);if(w.onerror)w.onerror(e.message,e.fileName,e.lineNumber);return this}}for(d=this.firstChild;d;d=c)c=d.nextSibling,U.call(d,a);D&&"SELECT"==this.nodeName&&this.parentNode.insertBefore(this,this);return this}function t(a){for(var b=this.length=a.length;b--;)this[b]=a[b]}function V(a){var b="closest"==a||"find"==a;E[a]=function(){for(var d,g= | ||
0,f=this.length;g<f;)if(d=c[a].apply(this[g++],arguments),b&&d)return d;return b?null:this}}function W(a){function b(a,d,l,n,m,h){for(m=d.length;m<=e[0];)e.shift(),c=c.plugin?c.plugin.done():c.parentNode||c[0].parentNode;c.txtMode?c.txt+=a+"\n":l?f.plugins[n]?(c=(new f.plugins[n](c,h)).el,e.unshift(m)):c.append(a):(n&&(c=f(n,0,1).to(c),e.unshift(m)),h&&(m=h.charAt(0),n=h.slice(1),">"==m?(d+" "+n).replace(X,b):"|"==m||"\\"==m?c.append(n):"/"!=m&&("&"!=m&&(n=("INPUT"==c.tagName?"val":"txt")+":_('"+ | ||
h.replace(/'/g,"\\'")+"').format(data)"),m=k.call(c,"data-bind"),k.call(c,"data-bind",(m?m+";":"")+n))))}var d=l.createDocumentFragment(),c=d,e=[-1];a.replace(X,b);d=d.childNodes;return 1==d.length?d[0]:d}function F(a,b){this.name=b;this.parent=a;this.el=f("div");this.el.plugin=this}function z(a){this.txtMode=this.parent=a;this.txt="";this.plugin=this.el=this}function e(a,b){b=e[G(b)||u];return b[a]||b[a=a.slice(a.indexOf(":")+1)||a]||a}function G(a){return a&&(e[a=(""+a).toLowerCase()]||e[a=a.split("-")[0]])&& | ||
a}function Y(a){(a=G(a))&&u!=a&&(e[u=e.current=a]=e[u]||{});return u}function Z(a,b){-1==e.list.indexOf(a)&&e.list.push(a);Object.merge(e[a]||(e[a]={}),b);u||Y(a)}var u,v,D=!+"\v1",da=D&&8>(l.documentMode|0),fa=Object[h].hasOwnProperty,E=[],aa=l.body,Q=l.createElement,H="textContent"in aa?"textContent":"innerText",B=f.cache={},T=0,S=f.data={_:e},c=(w.HTMLElement||w.Element||f)[h],X=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm,ea=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g, | ||
q=f.bindings={"class":function(a,b){O.call(this,a,2>arguments.length||b)},css:function(a,b){this.style[a.camelCase()]=b||""},data:function(a,b){this.attr("data-"+a,b)},html:function(a){this.innerHTML=a}},ga=c.matches||function(a){return!!J(a)(this)},R=c.closest||function(a){for(var b=this;b;b=b.parentNode)if(ga.call(b,a))return b;return null},L=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,ca=/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/,ba=/\s*,\s*(?=(?:[^'"()]|"(?:\\?.)*?"|'(?:\\?.)*?'|\(.+?\))+$)/, | ||
K={},M={"first-child":"(a=_.parentNode)&&a.firstChild==_","last-child":"(a=_.parentNode)&&a.lastChild==_",".":"~_.className.split(/\\s+/).indexOf(a)","#":"_.id==a","^":"!a.indexOf(v)","|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)","*":"~a.indexOf(v)"};w.El=f;c.append=x;c.after=function(a,b){x.call(a.parentNode,this,b?a:a.nextSibling);return this};c.to=function(a,b){x.call(a,this,b);return this};c.hasClass=y;c.addClass=C;c.rmClass=N;c.toggleClass=O;c.empty=function(){for(var a;a= | ||
this.firstChild;)P.call(a);return this};c.kill=P;c.on=function(a,b){Event.add(this,a,b);return this};c.non=function(a,b){Event.remove(this,a,b);return this};c.emit=function(){Event.Emitter.emit.apply(this,arguments)};c.attr=k;f.scope=p;c.render=U;c.txt=q.txt=function(a){return arguments.length&&this[H]!=a?this[H]=a:this[H]};c.val=q.val=function(a){var b=this,c=b.type,e=b.options;if(arguments.length)return b.value=a;if(e){if("select-multiple"==c){a=[];for(c=0;b=e[c++];)b.selected&&!b.disabled&&a.push(b.valObject|| | ||
b.value);return a}a=b.selectedIndex;b=-1<a&&e[a]||b}return"checkbox"!=c&&"radio"!=c||b.checked?b.valObject||b.value:null};c.find=!D&&c.querySelector||function(a){return I(this,a,!0)};c.findAll=c.querySelectorAll?function(a){return new t(this.querySelectorAll(a))}:function(a){return new t(I(this,a))};f.wrap=t;t[h]=E;Object.keys(c).each(V);V("closest");E.cloneNode=function(a){return new t(this.map(function(b){return b.cloneNode(a)}))};c==f[h]&&(l.createElement=function(a){return Object.merge(Q(a),c)}, | ||
Object.merge(aa,c));f[h]=c;f.get=function(a){"string"==typeof a&&(a=l.getElementById(a));return a&&a.to?a:Object.merge(a,c)};f.css=function(a){v||(v=f("style").to(l.getElementsByTagName("head")[0]));v.styleSheet?v.styleSheet.cssText+=a:v.appendChild(l.createTextNode(a))};F[h]={_done:function(){var a=1<this.el.childNodes.length?new t(this.el.childNodes):this.el.firstChild;this.el.plugin=this.el=this.parent=null;return a},done:function(){var a=this.parent;B[this.name]=this._done();return a}};z[h].done= | ||
Fn("Function(this.txt)(),this.parent");f.plugins={binding:z.extend({done:function(){Object.merge(q,Function("return({"+this.txt+"})")());return this.parent}}),css:z.extend({done:Fn("El.css(this.txt),this.parent")}),js:z,template:F};f.view=f.tpl=W;f.include=function(a,b,c){b=f.get(a);(new F(null,a)).el.append(W(b.innerHTML)).plugin.done();b.kill()};f.i18n=e;e.list=[];e.get=G;e.use=Y;e.add=Z;e.def=function(a){Object.each(a,function(b,c){Z(c,a)})};String[h].lang=function(a){return e(this,a)}}(window, | ||
!function(w,l,k){function H(a,b,d){for(var h=[],c=a.firstChild,p=I(b);b=c;){if(p(b)){if(d)return b;h.push(b)}for(c=b.firstChild||b.nextSibling;!c&&(b=b.parentNode)!==a;)c=b.nextSibling}return d?null:h}function I(a){return J[a]||(J[a]=Function("_,v,a,b","return "+a.split(aa).map(function(a){var d,h,c=["_&&_.nodeType==1"],p=a.replace(ba,function(a,b,c,g){h=g+b.length;d=b.trim();return""});(a=a.slice(h).replace(K,function(a,b,d,h,p,e,f){c.push("((v='"+(h||(f?e.slice(1,-1):e)||"").replace(/'/g,"\\'")+ | ||
"'),(a='"+d+"'),1)",L[":"==b?d:b]||"(a=_.getAttribute(a))"+(p?"&&"+L[p]:e?"==v":""));return""}))&&"*"!=a&&(c[0]+="&&_.nodeName=='"+a.toUpperCase()+"'");p&&c.push("+"==d?"(a=_.previousSibling)":"(a=_.parentNode)",(d?"a.matches&&a.matches('":"a.closest&&a.closest('")+p+"')");return c.join("&&")}).join("||")))}function e(a,b,d){var h={};a=a.replace(K,function(a,b,d,c,e,g,f){g=f?g.slice(1,-1):g||d;h[b="."==b?(e="~","class"):"#"==b?"id":d]=e&&h[b]?"^"==e?g+h[b]:h[b]+("~"==e?" ":"")+g:g;return""})||"div"; | ||
a=(A[a]||(A[a]=l.createElement(a))).cloneNode(!0).attr(h);return d||!b?a:("object"==typeof b?m:x).call(a,b)}function x(a,b){var d,h=0,c=typeof a;if(a){if("string"==c||"number"==c)a=l.createTextNode(a);else if(!("nodeType"in a)&&"length"in a){c=a.length;for(d=l.createDocumentFragment();h<c;)x.call(d,a[h++]);a=d}a.nodeType&&(c=this.insertBefore?this:this[this.length-1],c.insertBefore(a,(!0===b?c.firstChild:"number"==typeof b?c.childNodes[0>b?c.childNodes.length-b-2:b]:b)||null))}return this}function y(a){return-1< | ||
this.className.split(/\s+/).indexOf(a)}function B(a){var b=this.className;b&&(a=y.call(this,a)?b:b+" "+a);b!=a&&(this.className=a);return this}function M(a){y.call(this,a)&&(this.className=(" "+this.className+" ").replace(" "+a+" "," ").trim());return this}function N(a,b){1==arguments.length&&(b=!y.call(this,a));return(b?B:M).call(this,a),b}function O(){var a;this.emit&&this.emit("kill");this.parentNode&&this.parentNode.removeChild(this);Event.removeAll&&Event.removeAll(this);this.empty&&this.empty(); | ||
(a=this.attr&&this.attr("data-scope"))&&delete q[a];this.valObject&&(this.valObject=null);return this}function m(a,b){var d;if(a&&a.constructor==Object){for(b in a)m.call(this,b,a[b]);return this}d=this.getAttribute(a);if(1==arguments.length)return d;!ca||"id"!=a&&"name"!=a&&"checked"!=a?"class"==a?B.call(this,b):b||0===b?d!=b&&this.setAttribute(a,b):d&&this.removeAttribute(a):this.mergeAttributes(P("<INPUT "+a+'="'+b+'">'),!1)}function q(a,b,d){if(d=q[m.call(a,"data-scope")])return d;b&&!0!==b|| | ||
(d=(d=Q.call(a,"[data-scope]"))&&q[m.call(d,"data-scope")]||R);b&&(m.call(a,"data-scope",++S),d=q[S]=Object.create(b=d||b),d._super=b);return d}function T(a,b){var d,c,e;if(1!=this.nodeType)return this;a=q[m.call(this,"data-scope")]||a||(d=Q.call(this,"[data-scope]"))&&q[m.call(d,"data-scope")]||R;if(d=!b&&m.call(this,"data-bind")){c=d;e="data b r->data&&("+d.replace(da,function(a,b,d){return r[b]?(ea.call(r[b],"once")&&(c=c.replace(a,"")),"(r=b['"+b+"'].call(this"+(r[b].raw?",data,'"+d+"'":d?","+ | ||
d:"")+")||r),"):"this.attr('"+b+"',"+d+"),"})+"r)";d!=c&&m.call(this,"data-bind",c);try{if(Fn(e,this,a)(a,r))return this}catch(f){f.message+=" in binding: "+d;console.error(f);if(w.onerror)w.onerror(f.message,f.fileName,f.lineNumber);return this}}for(d=this.firstChild;d;d=c)c=d.nextSibling,T.call(d,a);C&&"SELECT"==this.nodeName&&this.parentNode.insertBefore(this,this);return this}function t(a){for(var b=this.length=a.length;b--;)this[b]=a[b]}function U(a){var b="closest"==a||"find"==a;D[a]=function(){for(var d, | ||
h=0,e=this.length;h<e;)if(d=c[a].apply(this[h++],arguments),b&&d)return d;return b?null:this}}function V(a){function b(a,d,l,n,g,k){for(g=d.length;g<=f[0];)f.shift(),c=c.plugin?c.plugin.done():c.parentNode||c[0].parentNode;c.txtMode?c.txt+=a+"\n":l?e.plugins[n]?(c=(new e.plugins[n](c,k)).el,f.unshift(g)):c.append(a):(n&&(c=e(n,0,1).to(c),f.unshift(g)),k&&(g=k.charAt(0),n=k.slice(1),">"==g?(d+" "+n).replace(W,b):"|"==g||"\\"==g?c.append(n):"/"!=g&&("&"!=g&&(n=("INPUT"==c.tagName?"val":"txt")+":_('"+ | ||
k.replace(/'/g,"\\'")+"').format(data)"),g=m.call(c,"data-bind"),m.call(c,"data-bind",(g?g+";":"")+n))))}var d=l.createDocumentFragment(),c=d,f=[-1];a.replace(W,b);d=d.childNodes;return 1==d.length?d[0]:d}function E(a,b){this.name=b;this.parent=a;this.el=e("div");this.el.plugin=this}function z(a){this.txtMode=this.parent=a;this.txt="";this.plugin=this.el=this}function f(a,b){b=f[F(b)||u];return b[a]||b[a=a.slice(a.indexOf(":")+1)||a]||a}function F(a){return a&&(f[a=(""+a).toLowerCase()]||f[a=a.split("-")[0]])&& | ||
a}function X(a){(a=F(a))&&u!=a&&(f[u=f.current=a]=f[u]||{});return u}function Y(a,b){-1==f.list.indexOf(a)&&f.list.push(a);Object.merge(f[a]||(f[a]={}),b);u||X(a)}var u,v,C=!+"\v1",ca=C&&8>(l.documentMode|0),ea=Object[k].hasOwnProperty,D=[],Z=l.body,P=l.createElement,G="textContent"in Z?"textContent":"innerText",A=e.cache={},S=0,R=e.data={_:f},c=(w.HTMLElement||w.Element||e)[k],W=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm,da=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g, | ||
r=e.bindings={"class":function(a,b){N.call(this,a,2>arguments.length||b)},css:function(a,b){this.style[a.camelCase()]=b||""},data:function(a,b){this.attr("data-"+a,b)},html:function(a){this.innerHTML=a}},fa=c.matches=c.matches||function(a){return!!I(a)(this)},Q=c.closest=c.closest||function(a){for(var b=this;b;b=b.parentNode)if(fa.call(b,a))return b;return null},K=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,ba=/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/,aa=/\s*,\s*(?=(?:[^'"()]|"(?:\\?.)*?"|'(?:\\?.)*?'|\(.+?\))+$)/, | ||
J={},L={"first-child":"(a=_.parentNode)&&a.firstChild==_","last-child":"(a=_.parentNode)&&a.lastChild==_",".":"~_.className.split(/\\s+/).indexOf(a)","#":"_.id==a","^":"!a.indexOf(v)","|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)","*":"~a.indexOf(v)"};w.El=e;c.append=x;c.after=function(a,b){x.call(a.parentNode,this,b?a:a.nextSibling);return this};c.to=function(a,b){x.call(a,this,b);return this};c.hasClass=y;c.addClass=B;c.rmClass=M;c.toggleClass=N;c.empty=function(){for(var a;a= | ||
this.firstChild;)O.call(a);return this};c.kill=O;c.on=function(a,b){Event.add(this,a,b);return this};c.non=function(a,b){Event.remove(this,a,b);return this};c.emit=function(){Event.Emitter.emit.apply(this,arguments)};c.attr=m;e.scope=q;c.render=T;c.txt=r.txt=function(a){return arguments.length&&this[G]!=a?this[G]=a:this[G]};c.val=r.val=function(a){var b=this,c=b.type,e=b.options;if(arguments.length)return b.value=a;if(e){if("select-multiple"==c){a=[];for(c=0;b=e[c++];)b.selected&&!b.disabled&&a.push(b.valObject|| | ||
b.value);return a}a=b.selectedIndex;b=-1<a&&e[a]||b}return"checkbox"!=c&&"radio"!=c||b.checked?b.valObject||b.value:null};c.find=!C&&c.querySelector||function(a){return H(this,a,!0)};c.findAll=c.querySelectorAll?function(a){return new t(this.querySelectorAll(a))}:function(a){return new t(H(this,a))};e.wrap=t;t[k]=D;Object.keys(c).each(U);U("closest");D.cloneNode=function(a){return new t(this.map(function(b){return b.cloneNode(a)}))};c==e[k]&&(l.createElement=function(a){return Object.merge(P(a),c)}, | ||
Object.merge(Z,c));e[k]=c;e.get=function(a){"string"==typeof a&&(a=l.getElementById(a));return a&&a.to?a:Object.merge(a,c)};e.css=function(a){v||(v=e("style").to(l.getElementsByTagName("head")[0]));v.styleSheet?v.styleSheet.cssText+=a:v.appendChild(l.createTextNode(a))};E[k]={_done:function(){var a=1<this.el.childNodes.length?new t(this.el.childNodes):this.el.firstChild;this.el.plugin=this.el=this.parent=null;return a},done:function(){var a=this.parent;A[this.name]=this._done();return a}};z[k].done= | ||
Fn("Function(this.txt)(),this.parent");e.plugins={binding:z.extend({done:function(){Object.merge(r,Function("return({"+this.txt+"})")());return this.parent}}),css:z.extend({done:Fn("El.css(this.txt),this.parent")}),js:z,template:E};e.view=e.tpl=V;e.include=function(a,b,c){b=e.get(a);(new E(null,a)).el.append(V(b.innerHTML)).plugin.done();b.kill()};e.i18n=f;f.list=[];f.get=F;f.use=X;f.add=Y;f.def=function(a){Object.each(a,function(b,c){Y(c,a)})};String[k].lang=function(a){return f(this,a)}}(window, | ||
document,"prototype"); |
@@ -1,15 +0,15 @@ | ||
!function(v,k,n){function V(a){return G[a]||(G[a]=Function("_,v,a,b","return "+a.split(W).map(function(a){var c,e,p=["_&&_.nodeType==1"],d=a.replace(X,function(a,b,d,p){e=p+b.length;c=b.trim();return""});(a=a.slice(e).replace(H,function(a,b,c,e,d,f,Y){p.push("((v='"+(e||(Y?f.slice(1,-1):f)||"").replace(/'/g,"\\'")+"'),(a='"+c+"'),1)",I[":"==b?c:b]||"(a=_.getAttribute(a))"+(d?"&&"+I[d]:f?"==v":""));return""}))&&"*"!=a&&(p[0]+="&&_.nodeName=='"+a.toUpperCase()+"'");d&&p.push("+"==c?"(a=_.previousSibling)": | ||
"(a=_.parentNode)",(c?"a.matches&&a.matches('":"a.closest&&a.closest('")+d+"')");return p.join("&&")}).join("||")))}function f(a,b,c){var e={};a=a.replace(H,function(a,b,c,d,f,h,g){h=g?h.slice(1,-1):h||c;e[b="."==b?(f="~","class"):"#"==b?"id":c]=f&&e[b]?"^"==f?h+e[b]:e[b]+("~"==f?" ":"")+h:h;return""})||"div";a=(A[a]||(A[a]=k.createElement(a))).cloneNode(!0).attr(e);return c||!b?a:("object"==typeof b?l:w).call(a,b)}function w(a,b){var c,e=0,d=typeof a;if(a){if("string"==d||"number"==d)a=k.createTextNode(a); | ||
else if(!("nodeType"in a)&&"length"in a){d=a.length;for(c=k.createDocumentFragment();e<d;)w.call(c,a[e++]);a=c}a.nodeType&&(d=this.insertBefore?this:this[this.length-1],d.insertBefore(a,(!0===b?d.firstChild:"number"==typeof b?d.childNodes[0>b?d.childNodes.length-b-2:b]:b)||null))}return this}function y(a){return-1<this.className.split(/\s+/).indexOf(a)}function B(a){var b=this.className;b&&(a=y.call(this,a)?b:b+" "+a);b!=a&&(this.className=a);return this}function J(a){y.call(this,a)&&(this.className= | ||
(" "+this.className+" ").replace(" "+a+" "," ").trim());return this}function K(a,b){1==arguments.length&&(b=!y.call(this,a));return(b?B:J).call(this,a),b}function L(){var a;this.emit&&this.emit("kill");this.parentNode&&this.parentNode.removeChild(this);Event.removeAll&&Event.removeAll(this);this.empty&&this.empty();(a=this.attr&&this.attr("data-scope"))&&delete q[a];this.valObject&&(this.valObject=null);return this}function l(a,b){var c;if(a&&a.constructor==Object){for(b in a)l.call(this,b,a[b]); | ||
return this}c=this.getAttribute(a);if(1==arguments.length)return c;"class"==a?B.call(this,b):b||0===b?c!=b&&this.setAttribute(a,b):c&&this.removeAttribute(a)}function q(a,b,c){if(c=q[l.call(a,"data-scope")])return c;b&&!0!==b||(c=(c=M.call(a,"[data-scope]"))&&q[l.call(c,"data-scope")]||N);b&&(l.call(a,"data-scope",++O),c=q[O]=Object.create(b=c||b),c._super=b);return c}function P(a,b){var c,e,d;if(1!=this.nodeType)return this;a=q[l.call(this,"data-scope")]||a||(c=M.call(this,"[data-scope]"))&&q[l.call(c, | ||
"data-scope")]||N;if(c=!b&&l.call(this,"data-bind")){e=c;d="data b r->data&&("+c.replace(Z,function(a,b,c){return r[b]?(aa.call(r[b],"once")&&(e=e.replace(a,"")),"(r=b['"+b+"'].call(this,"+(r[b].raw?"data,'"+c+"'":c)+")||r),"):"this.attr('"+b+"',"+c+"),"})+"r)";c!=e&&l.call(this,"data-bind",e);try{if(Fn(d,this,a)(a,r))return this}catch(f){f.message+=" in binding: "+c;console.error(f);if(v.onerror)v.onerror(f.message,f.fileName,f.lineNumber);return this}}for(c=this.firstChild;c;c=e)e=c.nextSibling, | ||
P.call(c,a);return this}function x(a){for(var b=this.length=a.length;b--;)this[b]=a[b]}function Q(a){var b="closest"==a||"find"==a;C[a]=function(){for(var c,e=0,f=this.length;e<f;)if(c=d[a].apply(this[e++],arguments),b&&c)return c;return b?null:this}}function R(a){function b(a,c,g,m,h,k){for(h=c.length;h<=d[0];)d.shift(),e=e.plugin?e.plugin.done():e.parentNode||e[0].parentNode;e.txtMode?e.txt+=a+"\n":g?f.plugins[m]?(e=(new f.plugins[m](e,k)).el,d.unshift(h)):e.append(a):(m&&(e=f(m,0,1).to(e),d.unshift(h)), | ||
k&&(h=k.charAt(0),m=k.slice(1),">"==h?(c+" "+m).replace(S,b):"|"==h||"\\"==h?e.append(m):"/"!=h&&("&"!=h&&(m=("INPUT"==e.tagName?"val":"txt")+":_('"+k.replace(/'/g,"\\'")+"').format(data)"),h=l.call(e,"data-bind"),l.call(e,"data-bind",(h?h+";":"")+m))))}var c=k.createDocumentFragment(),e=c,d=[-1];a.replace(S,b);c=c.childNodes;return 1==c.length?c[0]:c}function D(a,b){this.name=b;this.parent=a;this.el=f("div");this.el.plugin=this}function z(a){this.txtMode=this.parent=a;this.txt="";this.plugin=this.el= | ||
this}function g(a,b){b=g[E(b)||t];return b[a]||b[a=a.slice(a.indexOf(":")+1)||a]||a}function E(a){return a&&(g[a=(""+a).toLowerCase()]||g[a=a.split("-")[0]])&&a}function T(a){(a=E(a))&&t!=a&&(g[t=g.current=a]=g[t]||{});return t}function U(a,b){-1==g.list.indexOf(a)&&g.list.push(a);Object.merge(g[a]||(g[a]={}),b);t||T(a)}var t,u,aa=Object[n].hasOwnProperty,C=[],F="textContent"in k.body?"textContent":"innerText",A=f.cache={},O=0,N=f.data={_:g},d=(v.HTMLElement||v.Element||f)[n],S=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm, | ||
Z=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g,r=f.bindings={"class":function(a,b){K.call(this,a,2>arguments.length||b)},css:function(a,b){this.style[a.camelCase()]=b||""},data:function(a,b){this.attr("data-"+a,b)},html:function(a){this.innerHTML=a}},ba=d.matches||function(a){return!!V(a)(this)},M=d.closest||function(a){for(var b=this;b;b=b.parentNode)if(ba.call(b,a))return b;return null},H=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,X=/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/, | ||
W=/\s*,\s*(?=(?:[^'"()]|"(?:\\?.)*?"|'(?:\\?.)*?'|\(.+?\))+$)/,G={},I={"first-child":"(a=_.parentNode)&&a.firstChild==_","last-child":"(a=_.parentNode)&&a.lastChild==_",".":"~_.className.split(/\\s+/).indexOf(a)","#":"_.id==a","^":"!a.indexOf(v)","|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)","*":"~a.indexOf(v)"};v.El=f;d.append=w;d.after=function(a,b){w.call(a.parentNode,this,b?a:a.nextSibling);return this};d.to=function(a,b){w.call(a,this,b);return this};d.hasClass= | ||
y;d.addClass=B;d.rmClass=J;d.toggleClass=K;d.empty=function(){for(var a;a=this.firstChild;)L.call(a);return this};d.kill=L;d.on=function(a,b){Event.add(this,a,b);return this};d.non=function(a,b){Event.remove(this,a,b);return this};d.emit=function(){Event.Emitter.emit.apply(this,arguments)};d.attr=l;f.scope=q;d.render=P;d.txt=r.txt=function(a){return arguments.length&&this[F]!=a?this[F]=a:this[F]};d.val=r.val=function(a){var b=this,c=b.type,d=b.options;if(arguments.length)return b.value=a;if(d){if("select-multiple"== | ||
c){a=[];for(c=0;b=d[c++];)b.selected&&!b.disabled&&a.push(b.valObject||b.value);return a}a=b.selectedIndex;b=-1<a&&d[a]||b}return"checkbox"!=c&&"radio"!=c||b.checked?b.valObject||b.value:null};d.find=d.querySelector;d.findAll=function(a){return new x(this.querySelectorAll(a))};f.wrap=x;x[n]=C;Object.keys(d).each(Q);Q("closest");C.cloneNode=function(a){return new x(this.map(function(b){return b.cloneNode(a)}))};f[n]=d;f.get=function(a){"string"==typeof a&&(a=k.getElementById(a));return a};f.css=function(a){u|| | ||
(u=f("style").to(k.getElementsByTagName("head")[0]));u.styleSheet?u.styleSheet.cssText+=a:u.appendChild(k.createTextNode(a))};D[n]={_done:function(){var a=1<this.el.childNodes.length?new x(this.el.childNodes):this.el.firstChild;this.el.plugin=this.el=this.parent=null;return a},done:function(){var a=this.parent;A[this.name]=this._done();return a}};z[n].done=Fn("Function(this.txt)(),this.parent");f.plugins={binding:z.extend({done:function(){Object.merge(r,Function("return({"+this.txt+"})")());return this.parent}}), | ||
css:z.extend({done:Fn("El.css(this.txt),this.parent")}),js:z,template:D};f.view=f.tpl=R;f.include=function(a,b,c){b=f.get(a);(new D(null,a)).el.append(R(b.innerHTML)).plugin.done();b.kill()};f.i18n=g;g.list=[];g.get=E;g.use=T;g.add=U;g.def=function(a){Object.each(a,function(b,c){U(c,a)})};String[n].lang=function(a){return g(this,a)}}(window,document,"prototype"); | ||
!function(u,h,n){function V(a){return G[a]||(G[a]=Function("_,v,a,b","return "+a.split(W).map(function(a){var c,f,e=["_&&_.nodeType==1"],d=a.replace(X,function(a,b,e,d){f=d+b.length;c=b.trim();return""});(a=a.slice(f).replace(H,function(a,b,c,f,d,z,g){e.push("((v='"+(f||(g?z.slice(1,-1):z)||"").replace(/'/g,"\\'")+"'),(a='"+c+"'),1)",I[":"==b?c:b]||"(a=_.getAttribute(a))"+(d?"&&"+I[d]:z?"==v":""));return""}))&&"*"!=a&&(e[0]+="&&_.nodeName=='"+a.toUpperCase()+"'");d&&e.push("+"==c?"(a=_.previousSibling)": | ||
"(a=_.parentNode)",(c?"a.matches&&a.matches('":"a.closest&&a.closest('")+d+"')");return e.join("&&")}).join("||")))}function d(a,b,c){var f={};a=a.replace(H,function(a,b,c,e,d,g,k){g=k?g.slice(1,-1):g||c;f[b="."==b?(d="~","class"):"#"==b?"id":c]=d&&f[b]?"^"==d?g+f[b]:f[b]+("~"==d?" ":"")+g:g;return""})||"div";a=(A[a]||(A[a]=h.createElement(a))).cloneNode(!0).attr(f);return c||!b?a:("object"==typeof b?k:v).call(a,b)}function v(a,b){var c,f=0,d=typeof a;if(a){if("string"==d||"number"==d)a=h.createTextNode(a); | ||
else if(!("nodeType"in a)&&"length"in a){d=a.length;for(c=h.createDocumentFragment();f<d;)v.call(c,a[f++]);a=c}a.nodeType&&(d=this.insertBefore?this:this[this.length-1],d.insertBefore(a,(!0===b?d.firstChild:"number"==typeof b?d.childNodes[0>b?d.childNodes.length-b-2:b]:b)||null))}return this}function x(a){return-1<this.className.split(/\s+/).indexOf(a)}function B(a){var b=this.className;b&&(a=x.call(this,a)?b:b+" "+a);b!=a&&(this.className=a);return this}function J(a){x.call(this,a)&&(this.className= | ||
(" "+this.className+" ").replace(" "+a+" "," ").trim());return this}function K(a,b){1==arguments.length&&(b=!x.call(this,a));return(b?B:J).call(this,a),b}function L(){var a;this.emit&&this.emit("kill");this.parentNode&&this.parentNode.removeChild(this);Event.removeAll&&Event.removeAll(this);this.empty&&this.empty();(a=this.attr&&this.attr("data-scope"))&&delete p[a];this.valObject&&(this.valObject=null);return this}function k(a,b){var c;if(a&&a.constructor==Object){for(b in a)k.call(this,b,a[b]); | ||
return this}c=this.getAttribute(a);if(1==arguments.length)return c;"class"==a?B.call(this,b):b||0===b?c!=b&&this.setAttribute(a,b):c&&this.removeAttribute(a)}function p(a,b,c){if(c=p[k.call(a,"data-scope")])return c;b&&!0!==b||(c=(c=M.call(a,"[data-scope]"))&&p[k.call(c,"data-scope")]||N);b&&(k.call(a,"data-scope",++O),c=p[O]=Object.create(b=c||b),c._super=b);return c}function P(a,b){var c,f,d;if(1!=this.nodeType)return this;a=p[k.call(this,"data-scope")]||a||(c=M.call(this,"[data-scope]"))&&p[k.call(c, | ||
"data-scope")]||N;if(c=!b&&k.call(this,"data-bind")){f=c;d="data b r->data&&("+c.replace(Y,function(a,b,c){return q[b]?(Z.call(q[b],"once")&&(f=f.replace(a,"")),"(r=b['"+b+"'].call(this"+(q[b].raw?",data,'"+c+"'":c?","+c:"")+")||r),"):"this.attr('"+b+"',"+c+"),"})+"r)";c!=f&&k.call(this,"data-bind",f);try{if(Fn(d,this,a)(a,q))return this}catch(e){e.message+=" in binding: "+c;console.error(e);if(u.onerror)u.onerror(e.message,e.fileName,e.lineNumber);return this}}for(c=this.firstChild;c;c=f)f=c.nextSibling, | ||
P.call(c,a);return this}function w(a){for(var b=this.length=a.length;b--;)this[b]=a[b]}function Q(a){var b="closest"==a||"find"==a;C[a]=function(){for(var c,d=0,g=this.length;d<g;)if(c=e[a].apply(this[d++],arguments),b&&c)return c;return b?null:this}}function R(a){function b(a,c,g,m,l,h){for(l=c.length;l<=e[0];)e.shift(),f=f.plugin?f.plugin.done():f.parentNode||f[0].parentNode;f.txtMode?f.txt+=a+"\n":g?d.plugins[m]?(f=(new d.plugins[m](f,h)).el,e.unshift(l)):f.append(a):(m&&(f=d(m,0,1).to(f),e.unshift(l)), | ||
h&&(l=h.charAt(0),m=h.slice(1),">"==l?(c+" "+m).replace(S,b):"|"==l||"\\"==l?f.append(m):"/"!=l&&("&"!=l&&(m=("INPUT"==f.tagName?"val":"txt")+":_('"+h.replace(/'/g,"\\'")+"').format(data)"),l=k.call(f,"data-bind"),k.call(f,"data-bind",(l?l+";":"")+m))))}var c=h.createDocumentFragment(),f=c,e=[-1];a.replace(S,b);c=c.childNodes;return 1==c.length?c[0]:c}function D(a,b){this.name=b;this.parent=a;this.el=d("div");this.el.plugin=this}function y(a){this.txtMode=this.parent=a;this.txt="";this.plugin=this.el= | ||
this}function g(a,b){b=g[E(b)||r];return b[a]||b[a=a.slice(a.indexOf(":")+1)||a]||a}function E(a){return a&&(g[a=(""+a).toLowerCase()]||g[a=a.split("-")[0]])&&a}function T(a){(a=E(a))&&r!=a&&(g[r=g.current=a]=g[r]||{});return r}function U(a,b){-1==g.list.indexOf(a)&&g.list.push(a);Object.merge(g[a]||(g[a]={}),b);r||T(a)}var r,t,Z=Object[n].hasOwnProperty,C=[],F="textContent"in h.body?"textContent":"innerText",A=d.cache={},O=0,N=d.data={_:g},e=(u.HTMLElement||u.Element||d)[n],S=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm, | ||
Y=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g,q=d.bindings={"class":function(a,b){K.call(this,a,2>arguments.length||b)},css:function(a,b){this.style[a.camelCase()]=b||""},data:function(a,b){this.attr("data-"+a,b)},html:function(a){this.innerHTML=a}},aa=e.matches=e.matches||function(a){return!!V(a)(this)},M=e.closest=e.closest||function(a){for(var b=this;b;b=b.parentNode)if(aa.call(b,a))return b;return null},H=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,X= | ||
/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/,W=/\s*,\s*(?=(?:[^'"()]|"(?:\\?.)*?"|'(?:\\?.)*?'|\(.+?\))+$)/,G={},I={"first-child":"(a=_.parentNode)&&a.firstChild==_","last-child":"(a=_.parentNode)&&a.lastChild==_",".":"~_.className.split(/\\s+/).indexOf(a)","#":"_.id==a","^":"!a.indexOf(v)","|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)","*":"~a.indexOf(v)"};u.El=d;e.append=v;e.after=function(a,b){v.call(a.parentNode,this,b?a:a.nextSibling);return this}; | ||
e.to=function(a,b){v.call(a,this,b);return this};e.hasClass=x;e.addClass=B;e.rmClass=J;e.toggleClass=K;e.empty=function(){for(var a;a=this.firstChild;)L.call(a);return this};e.kill=L;e.on=function(a,b){Event.add(this,a,b);return this};e.non=function(a,b){Event.remove(this,a,b);return this};e.emit=function(){Event.Emitter.emit.apply(this,arguments)};e.attr=k;d.scope=p;e.render=P;e.txt=q.txt=function(a){return arguments.length&&this[F]!=a?this[F]=a:this[F]};e.val=q.val=function(a){var b=this,c=b.type, | ||
d=b.options;if(arguments.length)return b.value=a;if(d){if("select-multiple"==c){a=[];for(c=0;b=d[c++];)b.selected&&!b.disabled&&a.push(b.valObject||b.value);return a}a=b.selectedIndex;b=-1<a&&d[a]||b}return"checkbox"!=c&&"radio"!=c||b.checked?b.valObject||b.value:null};e.find=e.querySelector;e.findAll=function(a){return new w(this.querySelectorAll(a))};d.wrap=w;w[n]=C;Object.keys(e).each(Q);Q("closest");C.cloneNode=function(a){return new w(this.map(function(b){return b.cloneNode(a)}))};d[n]=e;d.get= | ||
function(a){"string"==typeof a&&(a=h.getElementById(a));return a};d.css=function(a){t||(t=d("style").to(h.getElementsByTagName("head")[0]));t.styleSheet?t.styleSheet.cssText+=a:t.appendChild(h.createTextNode(a))};D[n]={_done:function(){var a=1<this.el.childNodes.length?new w(this.el.childNodes):this.el.firstChild;this.el.plugin=this.el=this.parent=null;return a},done:function(){var a=this.parent;A[this.name]=this._done();return a}};y[n].done=Fn("Function(this.txt)(),this.parent");d.plugins={binding:y.extend({done:function(){Object.merge(q, | ||
Function("return({"+this.txt+"})")());return this.parent}}),css:y.extend({done:Fn("El.css(this.txt),this.parent")}),js:y,template:D};d.view=d.tpl=R;d.include=function(a,b,c){b=d.get(a);(new D(null,a)).el.append(R(b.innerHTML)).plugin.done();b.kill()};d.i18n=g;g.list=[];g.get=E;g.use=T;g.add=U;g.def=function(a){Object.each(a,function(b,c){U(c,a)})};String[n].lang=function(a){return g(this,a)}}(window,document,"prototype"); |
16
index.js
@@ -5,4 +5,4 @@ | ||
/* | ||
* @version 0.10.0 | ||
* @date 2016-01-28 | ||
* @version 0.10.1 | ||
* @date 2016-02-16 | ||
* @stability 1 - Experimental | ||
@@ -48,7 +48,7 @@ * @author Lauri Rooden <lauri@rooden.ee> | ||
// Element.matches is supported from Chrome 34, Firefox 34 | ||
, matches = proto.matches || function(selector) { | ||
, matches = proto.matches = proto.matches || function(selector) { | ||
return !!selectorFn(selector)(this) | ||
} | ||
// Element.closest is supported from Chrome 41, Firefox 35 | ||
, closest = proto.closest || function(selector) { | ||
, closest = proto.closest = proto.closest || function(selector) { | ||
for (var el = this; el; el = el.parentNode) { | ||
@@ -362,3 +362,3 @@ if (matches.call(el, selector)) return el | ||
(hasOwn.call(bindings[name], "once") && (newBind = newBind.replace(match, "")), | ||
"(r=b['" + name + "'].call(this," + (bindings[name].raw ? "data,'" + args + "'" : args) + ")||r),") : | ||
"(r=b['" + name + "'].call(this" + (bindings[name].raw ? ",data,'" + args + "'" : args ? "," + args : "") + ")||r),") : | ||
"this.attr('" + name + "'," + args + ")," | ||
@@ -539,3 +539,3 @@ }) + "r)" | ||
function work(all, indent, plugin, name, q, text) { | ||
for (var i = indent.length; i <= stack[0]; ) { | ||
for (q = indent.length; q <= stack[0]; ) { | ||
stack.shift() | ||
@@ -550,3 +550,3 @@ parent = (parent.plugin) ? parent.plugin.done() : parent.parentNode || parent[0].parentNode | ||
parent = (new El.plugins[name](parent, text)).el | ||
stack.unshift(i) | ||
stack.unshift(q) | ||
} else { | ||
@@ -559,3 +559,3 @@ parent.append(all) | ||
// TODO:2015-02-27:lauri:should we find a child to where put a content? | ||
stack.unshift(i) | ||
stack.unshift(q) | ||
} | ||
@@ -562,0 +562,0 @@ if (text) { |
{ | ||
"name": "elements-lite", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"stability": 1, | ||
@@ -5,0 +5,0 @@ "author": "Lauri Rooden <lauri@rooden.ee>", |
@@ -7,4 +7,4 @@ [1]: https://secure.travis-ci.org/litejs/elements-lite.png | ||
@version 0.10.0 | ||
@date 2016-01-28 | ||
@version 0.10.1 | ||
@date 2016-02-16 | ||
@stability 1 - Experimental | ||
@@ -11,0 +11,0 @@ |
37362
662