elements-lite
Advanced tools
Comparing version 0.8.2 to 0.9.0
@@ -1,16 +0,17 @@ | ||
!function(q,m,k){function H(a,b,d){for(var g=[],r=a.firstChild,c=I(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 I(a){return J[a]||(J[a]=Function("_,v,a,b","return "+a.split(Y).map(function(a){var d,g,c=["_&&_.nodeType==1"],w=a.replace(Z,function(a,b,c,r){g=r+b.length;d=b.trim();return""});(a=a.slice(g).replace(K,function(a,b,d,g,w,f,e){c.push("((v='"+(g||(e?f.slice(1,-1):f)||"").replace(/'/g,"\\'")+"'),(a='"+ | ||
d+"'),1)",L[":"==b?d:b]||"(a=_.getAttribute(a))"+(w?"&&"+L[w]:f?"==v":""));return""}))&&"*"!=a&&(c[0]+="&&_.nodeName=='"+a.toUpperCase()+"'");w&&c.push("+"==d?"(a=_.previousSibling)":"(a=_.parentNode)",(d?"a.matches&&a.matches('":"a.closest&&a.closest('")+w+"')");return c.join("&&")}).join("||")))}function f(a,b,d){var g={};a=a.replace(K,function(a,b,d,c,f,e,h){e=h?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=(z[a]|| | ||
(z[a]=m.createElement(a))).cloneNode(!0).attr(g);return d||!b?a:("object"==typeof b?h:x).call(a,b)}function x(a,b){var d,g=0,c=typeof a;if(a){if("string"==c||"number"==c)a=m.createTextNode(a);else if(!("nodeType"in a)&&"length"in a){c=a.length;for(d=m.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 A(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?A: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 p[a];this.valObject&&(this.valObject=null);return this}function h(a,b){var d;if(a&&a.constructor==Object){for(b in a)h.call(this,b,a[b]);return this}d=this.getAttribute(a);if(1==arguments.length)return d;!aa||"id"!=a&&"name"!=a&&"checked"!=a?"class"==a?A.call(this,b):b||0===b?d!=b&&this.setAttribute(a,b):d&&this.removeAttribute(a):this.mergeAttributes(P("<INPUT "+a+'="'+b+'">'),!1)}function p(a,b,d){if(d=p[h.call(a,"data-scope")])return d;b&&!0!==b|| | ||
(d=(d=B.call(a,"[data-scope]"))&&p[h.call(d,"data-scope")]||Q);b&&(h.call(a,"data-scope",++R),d=p[R]=Object.create(b=d||b),d._super=b);return d}function S(a,b){var d,c,f;if(1!=this.nodeType)return this;a=p[h.call(this,"data-scope")]||a||(d=B.call(this,"[data-scope]"))&&p[h.call(d,"data-scope")]||Q;if(d=!b&&h.call(this,"data-bind")){c=d;f="data b r->data&&("+d.replace(ba,function(a,b,d){return t[b]?(ca.call(t[b],"once")&&(c=c.replace(a,"")),"(r=b['"+b+"'].call(this,"+(t[b].raw?"data,'"+d+"'":d)+")||r),"): | ||
"this.attr('"+b+"',"+d+"),"})+"r)";d!=c&&h.call(this,"data-bind",c);try{if(Fn(f,this,a)(a,t))return this}catch(e){e.message+=" in binding: "+d;console.error(e);if(q.onerror)q.onerror(e.message,e.fileName,e.lineNumber);return this}}for(d=this.firstChild;d;d=c)c=d.nextSibling,S.call(d,a);C&&"SELECT"==this.nodeName&&this.parentNode.insertBefore(this,this);return this}function B(a){for(var b=this;b;b=b.parentNode)if(b.matches&&b.matches(a))return b;return null}function u(a){for(var b=this.length=a.length;b--;)this[b]= | ||
a[b]}function T(a){function b(a,d,m,n,l,k){for(l=d.length;l<=e[0];)e.shift(),c=c.plugin?c.plugin.done():c.parentNode||c[0].parentNode;m?f.plugins[n]?(c=(new f.plugins[n](c,k)).el,e.unshift(l)):c.append(a):(n&&(c=f(n,0,1).to(c),e.unshift(l)),k&&(l=k.charAt(0),n=k.slice(1),">"==l?(d+" "+n).replace(U,b):"|"==l||"\\"==l?c.append(n):"/"!=l&&("&"!=l&&(n=("INPUT"==c.tagName?"val":"txt")+":_('"+k.replace(/'/g,"\\'")+"').format(data)"),l=h.call(c,"data-bind"),h.call(c,"data-bind",(l?l+";":"")+n))))}var d= | ||
m.createDocumentFragment(),c=d,e=[-1];a.replace(U,b);d=d.childNodes;return 1==d.length?d[0]:d}function D(a,b){this.name=b;this.parent=a;this.el=f("div");this.el.plugin=this;return this}function e(a,b){b=e[E(b)||v];return b[a]||b[a=a.slice(a.indexOf(":")+1)||a]||a}function E(a){return a&&(e[a=(""+a).toLowerCase()]||e[a=a.split("-")[0]])&&a}function V(a){(a=E(a))&&v!=a&&(e[v=e.current=a]=e[v]||{});return v}function W(a,b){-1==e.list.indexOf(a)&&e.list.push(a);Object.merge(e[a]||(e[a]={}),b);v||V(a)} | ||
var v,C=!+"\v1",aa=C&&8>(m.documentMode|0),ca=Object[k].hasOwnProperty,F=[],X=m.body,P=m.createElement,G="textContent"in X?"textContent":"innerText",z=f.cache={},R=0,Q=f.data={window:q,_:e},c=(q.HTMLElement||q.Element||f)[k],U=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm,ba=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g,t=f.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}},K=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,Z=/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/,Y=/\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)==0","|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)", | ||
"*":"~a.indexOf(v)"};q.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=A;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=h;f.scope=p;c.render=S;c.txt= | ||
t.txt=function(a){return arguments.length&&this[G]!=a?this[G]=a:this[G]};c.val=t.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}b=e[b.selectedIndex]||b}return"checkbox"!=c&&"radio"!=c||b.checked?b.valObject||b.value:null};c.matches||(c.matches=function(a){return!!I(a)(this)});c.closest||(c.closest=B);c.find=!C&&c.querySelector||function(a){return H(this, | ||
a,!0)};c.findAll=c.querySelectorAll?function(a){return new u(this.querySelectorAll(a))}:function(a){return new u(H(this,a))};f.wrap=u;u[k]=Object.keys(c).reduce(function(a,b){function d(){for(var a,e=0,f=this.length;e<f;)if(a=c[b].apply(this[e++],arguments),d.first&&a)return a;return d.first?null:this}a[b]=d;return a},F);F.find.first=1;F.cloneNode=function(a){return new u(this.map(function(b){return b.cloneNode(a)}))};c==f[k]&&(m.createElement=function(a){return Object.merge(P(a),c)},Object.merge(X, | ||
c));f[k]=c;f.get=function(a){"string"==typeof a&&(a=m.getElementById(a));return a&&a.to?a:Object.merge(a,c)};D[k]={_done:function(){var a=1<this.el.childNodes.length?new u(this.el.childNodes):this.el.firstChild;this.el.plugin=this.el=this.parent=null;return a},done:function(){var a=this.parent;z[this.name]=this._done();return a}};f.plugins={template:D};f.create=f.tpl=T;f.include=function(a,b,c){b=f.get(a);(new D(null,a)).el.append(T(b.innerHTML)).plugin.done();b.kill()};f.i18n=e;e.list=[];e.get=E; | ||
e.use=V;e.add=W;e.def=function(a){Object.each(a,function(b,c){W(c,a)})};String[k].lang=function(a){return e(this,a)}}(window,document,"prototype"); | ||
!function(w,l,h){function J(a,b,d){for(var g=[],r=a.firstChild,c=K(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 K(a){return L[a]||(L[a]=Function("_,v,a,b","return "+a.split(aa).map(function(a){var d,g,c=["_&&_.nodeType==1"],x=a.replace(ba,function(a,b,c,r){g=r+b.length;d=b.trim();return""});(a=a.slice(g).replace(M,function(a,b,d,g,x,f,e){c.push("((v='"+(g||(e?f.slice(1,-1):f)||"").replace(/'/g,"\\'")+ | ||
"'),(a='"+d+"'),1)",N[":"==b?d:b]||"(a=_.getAttribute(a))"+(x?"&&"+N[x]:f?"==v":""));return""}))&&"*"!=a&&(c[0]+="&&_.nodeName=='"+a.toUpperCase()+"'");x&&c.push("+"==d?"(a=_.previousSibling)":"(a=_.parentNode)",(d?"a.matches&&a.matches('":"a.closest&&a.closest('")+x+"')");return c.join("&&")}).join("||")))}function f(a,b,d){var g={};a=a.replace(M,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:y).call(a,b)}function y(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;)y.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 z(a){return-1< | ||
this.className.split(/\s+/).indexOf(a)}function C(a){var b=this.className;b&&(a=z.call(this,a)?b:b+" "+a);b!=a&&(this.className=a);return this}function O(a){z.call(this,a)&&(this.className=(" "+this.className+" ").replace(" "+a+" "," ").trim());return this}function P(a,b){1==arguments.length&&(b=!z.call(this,a));return(b?C:O).call(this,a),b}function Q(){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;!ca||"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(R("<INPUT "+a+'="'+b+'">'),!1)}function p(a,b,d){if(d=p[k.call(a,"data-scope")])return d;b&&!0!==b|| | ||
(d=(d=D.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=D.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(da,function(a,b,d){return q[b]?(ea.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);E&&"SELECT"==this.nodeName&&this.parentNode.insertBefore(this,this);return this}function D(a){for(var b=this;b;b=b.parentNode)if(b.matches&&b.matches(a))return b;return null}function t(a){for(var b=this.length=a.length;b--;)this[b]= | ||
a[b]}function V(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(W,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(W,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 A(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 X(a){(a=G(a))&&u!=a&&(e[u=e.current=a]=e[u]||{});return u}function Y(a, | ||
b){-1==e.list.indexOf(a)&&e.list.push(a);Object.merge(e[a]||(e[a]={}),b);u||X(a)}var u,v,E=!+"\v1",ca=E&&8>(l.documentMode|0),ea=Object[h].hasOwnProperty,H=[],Z=l.body,R=l.createElement,I="textContent"in Z?"textContent":"innerText",B=f.cache={},T=0,S=f.data={_:e},c=(w.HTMLElement||w.Element||f)[h],W=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm,da=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g,q=f.bindings={"class":function(a,b){P.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}},M=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,ba=/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/,aa=/\s*,\s*(?=(?:[^'"()]|"(?:\\?.)*?"|'(?:\\?.)*?'|\(.+?\))+$)/,L={},N={"first-child":"(a=_.parentNode)&&a.firstChild==_","last-child":"(a=_.parentNode)&&a.lastChild==_",".":"~_.className.split(/\\s+/).indexOf(a)","#":"_.id==a","^":"a.indexOf(v)==0", | ||
"|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)","*":"~a.indexOf(v)"};w.El=f;c.append=y;c.after=function(a,b){y.call(a.parentNode,this,b?a:a.nextSibling);return this};c.to=function(a,b){y.call(a,this,b);return this};c.hasClass=z;c.addClass=C;c.rmClass=O;c.toggleClass=P;c.empty=function(){for(var a;a=this.firstChild;)Q.call(a);return this};c.kill=Q;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[I]!=a?this[I]=a:this[I]};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}b=e[b.selectedIndex]||b}return"checkbox"!=c&&"radio"!=c||b.checked?b.valObject||b.value:null};c.matches||(c.matches=function(a){return!!K(a)(this)}); | ||
c.closest||(c.closest=D);c.find=!E&&c.querySelector||function(a){return J(this,a,!0)};c.findAll=c.querySelectorAll?function(a){return new t(this.querySelectorAll(a))}:function(a){return new t(J(this,a))};f.wrap=t;t[h]=Object.keys(c).reduce(function(a,b){function d(){for(var a,e=0,f=this.length;e<f;)if(a=c[b].apply(this[e++],arguments),d.first&&a)return a;return d.first?null:this}a[b]=d;return a},H);H.find.first=1;H.cloneNode=function(a){return new t(this.map(function(b){return b.cloneNode(a)}))}; | ||
c==f[h]&&(l.createElement=function(a){return Object.merge(R(a),c)},Object.merge(Z,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}};A[h].done=Fn("Function(this.txt)(),this.parent");f.plugins={binding:A.extend({done:function(){Object.merge(q,Function("return({"+this.txt+"})")());return this.parent}}),css:A.extend({done:Fn("El.css(this.txt),this.parent")}),js:A,template:F};f.create=f.tpl=V;f.include=function(a,b,c){b=f.get(a);(new F(null,a)).el.append(V(b.innerHTML)).plugin.done();b.kill()};f.i18n=e;e.list=[];e.get=G;e.use=X;e.add=Y;e.def=function(a){Object.each(a,function(b,c){Y(c, | ||
a)})};String[h].lang=function(a){return e(this,a)}}(window,document,"prototype"); |
@@ -1,15 +0,15 @@ | ||
!function(k,q,r){function T(a){return G[a]||(G[a]=Function("_,v,a,b","return "+a.split(U).map(function(a){var d,h,p=["_&&_.nodeType==1"],c=a.replace(V,function(a,b,c,p){h=p+b.length;d=b.trim();return""});(a=a.slice(h).replace(H,function(a,b,d,h,c,y,f){p.push("((v='"+(h||(f?y.slice(1,-1):y)||"").replace(/'/g,"\\'")+"'),(a='"+d+"'),1)",I[":"==b?d:b]||"(a=_.getAttribute(a))"+(c?"&&"+I[c]:y?"==v":""));return""}))&&"*"!=a&&(p[0]+="&&_.nodeName=='"+a.toUpperCase()+"'");c&&p.push("+"==d?"(a=_.previousSibling)": | ||
"(a=_.parentNode)",(d?"a.matches&&a.matches('":"a.closest&&a.closest('")+c+"')");return p.join("&&")}).join("||")))}function f(a,b,d){var h={};a=a.replace(H,function(a,b,d,c,f,g,e){g=e?g.slice(1,-1):g||d;h[b="."==b?(f="~","class"):"#"==b?"id":d]=f&&h[b]?"^"==f?g+h[b]:h[b]+("~"==f?" ":"")+g:g;return""})||"div";a=(z[a]||(z[a]=q.createElement(a))).cloneNode(!0).attr(h);return d||!b?a:("object"==typeof b?l:v).call(a,b)}function v(a,b){var d,h=0,c=typeof a;if(a){if("string"==c||"number"==c)a=q.createTextNode(a); | ||
else if(!("nodeType"in a)&&"length"in a){c=a.length;for(d=q.createDocumentFragment();h<c;)v.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 x(a){return-1<this.className.split(/\s+/).indexOf(a)}function A(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?A: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 n[a];this.valObject&&(this.valObject=null);return this}function l(a,b){var d;if(a&&a.constructor==Object){for(b in a)l.call(this,b,a[b]); | ||
return this}d=this.getAttribute(a);if(1==arguments.length)return d;"class"==a?A.call(this,b):b||0===b?d!=b&&this.setAttribute(a,b):d&&this.removeAttribute(a)}function n(a,b,d){if(d=n[l.call(a,"data-scope")])return d;b&&!0!==b||(d=(d=B.call(a,"[data-scope]"))&&n[l.call(d,"data-scope")]||M);b&&(l.call(a,"data-scope",++N),d=n[N]=Object.create(b=d||b),d._super=b);return d}function O(a,b){var d,c,f;if(1!=this.nodeType)return this;a=n[l.call(this,"data-scope")]||a||(d=B.call(this,"[data-scope]"))&&n[l.call(d, | ||
"data-scope")]||M;if(d=!b&&l.call(this,"data-bind")){c=d;f="data b r->data&&("+d.replace(W,function(a,b,d){return t[b]?(X.call(t[b],"once")&&(c=c.replace(a,"")),"(r=b['"+b+"'].call(this,"+(t[b].raw?"data,'"+d+"'":d)+")||r),"):"this.attr('"+b+"',"+d+"),"})+"r)";d!=c&&l.call(this,"data-bind",c);try{if(Fn(f,this,a)(a,t))return this}catch(e){e.message+=" in binding: "+d;console.error(e);if(k.onerror)k.onerror(e.message,e.fileName,e.lineNumber);return this}}for(d=this.firstChild;d;d=c)c=d.nextSibling, | ||
O.call(d,a);return this}function B(a){for(var b=this;b;b=b.parentNode)if(b.matches&&b.matches(a))return b;return null}function w(a){for(var b=this.length=a.length;b--;)this[b]=a[b]}function P(a){function b(a,d,n,m,g,k){for(g=d.length;g<=e[0];)e.shift(),c=c.plugin?c.plugin.done():c.parentNode||c[0].parentNode;n?f.plugins[m]?(c=(new f.plugins[m](c,k)).el,e.unshift(g)):c.append(a):(m&&(c=f(m,0,1).to(c),e.unshift(g)),k&&(g=k.charAt(0),m=k.slice(1),">"==g?(d+" "+m).replace(Q,b):"|"==g||"\\"==g?c.append(m): | ||
"/"!=g&&("&"!=g&&(m=("INPUT"==c.tagName?"val":"txt")+":_('"+k.replace(/'/g,"\\'")+"').format(data)"),g=l.call(c,"data-bind"),l.call(c,"data-bind",(g?g+";":"")+m))))}var d=q.createDocumentFragment(),c=d,e=[-1];a.replace(Q,b);d=d.childNodes;return 1==d.length?d[0]:d}function C(a,b){this.name=b;this.parent=a;this.el=f("div");this.el.plugin=this;return this}function e(a,b){b=e[D(b)||u];return b[a]||b[a=a.slice(a.indexOf(":")+1)||a]||a}function D(a){return a&&(e[a=(""+a).toLowerCase()]||e[a=a.split("-")[0]])&& | ||
a}function R(a){(a=D(a))&&u!=a&&(e[u=e.current=a]=e[u]||{});return u}function S(a,b){-1==e.list.indexOf(a)&&e.list.push(a);Object.merge(e[a]||(e[a]={}),b);u||R(a)}var u,X=Object[r].hasOwnProperty,E=[],F="textContent"in q.body?"textContent":"innerText",z=f.cache={},N=0,M=f.data={window:k,_:e},c=(k.HTMLElement||k.Element||f)[r],Q=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm,W=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g,t=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}},H=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,V=/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/,U=/\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)==0","|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)","*":"~a.indexOf(v)"};k.El=f;c.append=v;c.after=function(a,b){v.call(a.parentNode,this,b?a:a.nextSibling);return this};c.to=function(a,b){v.call(a,this,b);return this};c.hasClass=x;c.addClass=A;c.rmClass=J;c.toggleClass=K;c.empty=function(){for(var a;a=this.firstChild;)L.call(a);return this};c.kill=L;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=l;f.scope=n;c.render=O;c.txt=t.txt=function(a){return arguments.length&&this[F]!=a?this[F]=a:this[F]};c.val=t.val=function(a){var b=this,d=b.type,c=b.options;if(arguments.length)return b.value=a;if(c){if("select-multiple"==d){a=[];for(d=0;b=c[d++];)b.selected&&!b.disabled&&a.push(b.valObject||b.value);return a}b=c[b.selectedIndex]||b}return"checkbox"!=d&&"radio"!=d||b.checked?b.valObject||b.value:null};c.matches||(c.matches= | ||
function(a){return!!T(a)(this)});c.closest||(c.closest=B);c.find=c.querySelector;c.findAll=function(a){return new w(this.querySelectorAll(a))};f.wrap=w;w[r]=Object.keys(c).reduce(function(a,b){function d(){for(var a,e=0,f=this.length;e<f;)if(a=c[b].apply(this[e++],arguments),d.first&&a)return a;return d.first?null:this}a[b]=d;return a},E);E.find.first=1;E.cloneNode=function(a){return new w(this.map(function(b){return b.cloneNode(a)}))};f[r]=c;f.get=function(a){"string"==typeof a&&(a=q.getElementById(a)); | ||
return a};C[r]={_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;z[this.name]=this._done();return a}};f.plugins={template:C};f.create=f.tpl=P;f.include=function(a,b,c){b=f.get(a);(new C(null,a)).el.append(P(b.innerHTML)).plugin.done();b.kill()};f.i18n=e;e.list=[];e.get=D;e.use=R;e.add=S;e.def=function(a){Object.each(a,function(b,c){S(c,a)})};String[r].lang=function(a){return e(this, | ||
a)}}(window,document,"prototype"); | ||
!function(v,m,k){function U(a){return H[a]||(H[a]=Function("_,v,a,b","return "+a.split(V).map(function(a){var c,g,p=["_&&_.nodeType==1"],d=a.replace(W,function(a,b,d,p){g=p+b.length;c=b.trim();return""});(a=a.slice(g).replace(I,function(a,b,c,g,d,e,X){p.push("((v='"+(g||(X?e.slice(1,-1):e)||"").replace(/'/g,"\\'")+"'),(a='"+c+"'),1)",J[":"==b?c:b]||"(a=_.getAttribute(a))"+(d?"&&"+J[d]:e?"==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 e(a,b,c){var g={};a=a.replace(I,function(a,b,c,d,e,h,f){h=f?h.slice(1,-1):h||c;g[b="."==b?(e="~","class"):"#"==b?"id":c]=e&&g[b]?"^"==e?h+g[b]:g[b]+("~"==e?" ":"")+h:h;return""})||"div";a=(A[a]||(A[a]=m.createElement(a))).cloneNode(!0).attr(g);return c||!b?a:("object"==typeof b?l:w).call(a,b)}function w(a,b){var c,g=0,d=typeof a;if(a){if("string"==d||"number"==d)a=m.createTextNode(a); | ||
else if(!("nodeType"in a)&&"length"in a){d=a.length;for(c=m.createDocumentFragment();g<d;)w.call(c,a[g++]);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 K(a){y.call(this,a)&&(this.className= | ||
(" "+this.className+" ").replace(" "+a+" "," ").trim());return this}function L(a,b){1==arguments.length&&(b=!y.call(this,a));return(b?B:K).call(this,a),b}function M(){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=C.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,g,d;if(1!=this.nodeType)return this;a=q[l.call(this,"data-scope")]||a||(c=C.call(this,"[data-scope]"))&&q[l.call(c, | ||
"data-scope")]||N;if(c=!b&&l.call(this,"data-bind")){g=c;d="data b r->data&&("+c.replace(Y,function(a,b,c){return r[b]?(Z.call(r[b],"once")&&(g=g.replace(a,"")),"(r=b['"+b+"'].call(this,"+(r[b].raw?"data,'"+c+"'":c)+")||r),"):"this.attr('"+b+"',"+c+"),"})+"r)";c!=g&&l.call(this,"data-bind",g);try{if(Fn(d,this,a)(a,r))return this}catch(e){e.message+=" in binding: "+c;console.error(e);if(v.onerror)v.onerror(e.message,e.fileName,e.lineNumber);return this}}for(c=this.firstChild;c;c=g)g=c.nextSibling, | ||
P.call(c,a);return this}function C(a){for(var b=this;b;b=b.parentNode)if(b.matches&&b.matches(a))return b;return null}function x(a){for(var b=this.length=a.length;b--;)this[b]=a[b]}function Q(a){function b(a,c,m,n,h,k){for(h=c.length;h<=f[0];)f.shift(),d=d.plugin?d.plugin.done():d.parentNode||d[0].parentNode;d.txtMode?d.txt+=a+"\n":m?e.plugins[n]?(d=(new e.plugins[n](d,k)).el,f.unshift(h)):d.append(a):(n&&(d=e(n,0,1).to(d),f.unshift(h)),k&&(h=k.charAt(0),n=k.slice(1),">"==h?(c+" "+n).replace(R,b): | ||
"|"==h||"\\"==h?d.append(n):"/"!=h&&("&"!=h&&(n=("INPUT"==d.tagName?"val":"txt")+":_('"+k.replace(/'/g,"\\'")+"').format(data)"),h=l.call(d,"data-bind"),l.call(d,"data-bind",(h?h+";":"")+n))))}var c=m.createDocumentFragment(),d=c,f=[-1];a.replace(R,b);c=c.childNodes;return 1==c.length?c[0]:c}function D(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[E(b)||t];return b[a]||b[a=a.slice(a.indexOf(":")+ | ||
1)||a]||a}function E(a){return a&&(f[a=(""+a).toLowerCase()]||f[a=a.split("-")[0]])&&a}function S(a){(a=E(a))&&t!=a&&(f[t=f.current=a]=f[t]||{});return t}function T(a,b){-1==f.list.indexOf(a)&&f.list.push(a);Object.merge(f[a]||(f[a]={}),b);t||S(a)}var t,u,Z=Object[k].hasOwnProperty,F=[],G="textContent"in m.body?"textContent":"innerText",A=e.cache={},O=0,N=e.data={_:f},d=(v.HTMLElement||v.Element||e)[k],R=/^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm,Y=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[^;])*))?/g, | ||
r=e.bindings={"class":function(a,b){L.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}},I=/([.#:[])([-\w]+)(?:\((.+?)\)|([~^$*|]?)=(("|')(?:\\?.)*?\6|[-\w]+))?]?/g,W=/([\s>+]*)(?:("|')(?:\\?.)*?\2|\(.+?\)|[^\s+>])+$/,V=/\s*,\s*(?=(?:[^'"()]|"(?:\\?.)*?"|'(?:\\?.)*?'|\(.+?\))+$)/,H={},J={"first-child":"(a=_.parentNode)&&a.firstChild==_","last-child":"(a=_.parentNode)&&a.lastChild==_", | ||
".":"~_.className.split(/\\s+/).indexOf(a)","#":"_.id==a","^":"a.indexOf(v)==0","|":"a.split('-')[0]==v",$:"a.slice(-v.length)==v","~":"~a.split(/\\s+/).indexOf(v)","*":"~a.indexOf(v)"};v.El=e;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=K;d.toggleClass=L;d.empty=function(){for(var a;a=this.firstChild;)M.call(a);return this};d.kill=M;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;e.scope=q;d.render=P;d.txt=r.txt=function(a){return arguments.length&&this[G]!=a?this[G]=a:this[G]};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}b=d[b.selectedIndex]||b}return"checkbox"!=c&&"radio"!= | ||
c||b.checked?b.valObject||b.value:null};d.matches||(d.matches=function(a){return!!U(a)(this)});d.closest||(d.closest=C);d.find=d.querySelector;d.findAll=function(a){return new x(this.querySelectorAll(a))};e.wrap=x;x[k]=Object.keys(d).reduce(function(a,b){function c(){for(var a,e=0,f=this.length;e<f;)if(a=d[b].apply(this[e++],arguments),c.first&&a)return a;return c.first?null:this}a[b]=c;return a},F);F.find.first=1;F.cloneNode=function(a){return new x(this.map(function(b){return b.cloneNode(a)}))}; | ||
e[k]=d;e.get=function(a){"string"==typeof a&&(a=m.getElementById(a));return a};e.css=function(a){u||(u=e("style").to(m.getElementsByTagName("head")[0]));u.styleSheet?u.styleSheet.cssText+=a:u.appendChild(m.createTextNode(a))};D[k]={_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[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:D};e.create=e.tpl=Q;e.include=function(a,b,c){b=e.get(a);(new D(null,a)).el.append(Q(b.innerHTML)).plugin.done();b.kill()};e.i18n=f;f.list=[];f.get=E;f.use=S;f.add=T;f.def=function(a){Object.each(a,function(b,c){T(c,a)})};String[k].lang=function(a){return f(this,a)}}(window,document,"prototype"); |
44
index.js
@@ -5,4 +5,4 @@ | ||
/* | ||
* @version 0.8.2 | ||
* @date 2015-12-16 | ||
* @version 0.9.0 | ||
* @date 2016-01-07 | ||
* @stability 1 - Experimental | ||
@@ -17,3 +17,3 @@ * @author Lauri Rooden <lauri@rooden.ee> | ||
!function(window, document, protoStr) { | ||
var currentLang | ||
var currentLang, styleNode | ||
// JScript engine in IE<9 does not recognize vertical tabulation character | ||
@@ -29,3 +29,3 @@ , ie678 = !+"\v1" | ||
, scopeSeq = 0 | ||
, scopeData = El.data = { window: window, _: i18n } | ||
, scopeData = El.data = { _: i18n } | ||
, proto = (window.HTMLElement || window.Element || El)[protoStr] | ||
@@ -514,2 +514,12 @@ , templateRe = /^([ \t]*)(@?)((?:("|')(?:\\?.)*?\4|[-\w\:.#\[\]=])*)[ \t]*(.*?)$/gm | ||
El.css = function(str) { | ||
if (!styleNode) { | ||
// Safari and IE6-8 requires dynamically created | ||
// <style> elements to be inserted into the <head> | ||
styleNode = El("style").to(document.getElementsByTagName("head")[0]) | ||
} | ||
if (styleNode.styleSheet) styleNode.styleSheet.cssText += str | ||
else styleNode.appendChild(document.createTextNode(str)) | ||
} | ||
//** templates | ||
@@ -528,3 +538,5 @@ | ||
if (plugin) { | ||
if (parent.txtMode) { | ||
parent.txt += all + "\n" | ||
} else if (plugin) { | ||
if (El.plugins[name]) { | ||
@@ -571,3 +583,2 @@ parent = (new El.plugins[name](parent, text)).el | ||
t.el.plugin = t | ||
return t | ||
} | ||
@@ -590,4 +601,23 @@ | ||
function js(parent) { | ||
var t = this | ||
t.txtMode = t.parent = parent | ||
t.txt = "" | ||
t.plugin = t.el = t | ||
} | ||
js[protoStr].done = Fn("Function(this.txt)(),this.parent") | ||
El.plugins = { | ||
"template": template | ||
binding: js.extend({ | ||
done: function() { | ||
Object.merge(bindings, Function("return({" + this.txt + "})")()) | ||
return this.parent | ||
} | ||
}), | ||
css: js.extend({ | ||
done: Fn("El.css(this.txt),this.parent") | ||
}), | ||
js: js, | ||
template: template | ||
} | ||
@@ -594,0 +624,0 @@ |
{ | ||
"name": "elements-lite", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"stability": 1, | ||
@@ -35,3 +35,2 @@ "author": "Lauri Rooden <lauri@rooden.ee>", | ||
"browser-upgrade-lite": "*", | ||
"liquid-filters-lite": "*", | ||
"functional-lite": "0.5.0", | ||
@@ -38,0 +37,0 @@ "dom-lite": "*" |
@@ -7,4 +7,4 @@ [1]: https://secure.travis-ci.org/litejs/elements-lite.png | ||
@version 0.8.2 | ||
@date 2015-12-16 | ||
@version 0.9.0 | ||
@date 2016-01-07 | ||
@stability 1 - Experimental | ||
@@ -11,0 +11,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37138
6
656