Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

transparency

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

transparency - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

examples/backbone/customers.json

19

browser/spec/directives.spec.js

@@ -193,3 +193,3 @@ // Generated by CoffeeScript 1.3.3

});
return it("should throw an error unless directives are syntactically correct", function() {
it("should throw an error unless directives are syntactically correct", function() {
var data, directives, template;

@@ -209,4 +209,21 @@ template = $("<div id=\"template\">\n <div class=\"name\"></div>\n</div>");

});
return it("should use directive return value even if data value is null", function() {
var data, directives, expected, template;
template = $("<div id=\"template\">\n <div class=\"name\"></div>\n</div>");
expected = $("<div id=\"template\">\n <div class=\"name\">Null value</div>\n</div>");
data = {
name: null
};
directives = {
name: {
text: function() {
return "Null value";
}
}
};
template.render(data, directives);
return expect(template).toBeEqual(expected);
});
});
}).call(this);

12

lib/transparency.js

@@ -81,3 +81,3 @@ // Generated by CoffeeScript 1.3.3

value = model[key];
if (isPlainValue(value)) {
if ((value != null) && isPlainValue(value)) {
_ref1 = matchingElements(instance, key);

@@ -92,3 +92,3 @@ for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {

}
} else if (typeof value === 'object') {
} else if ((value != null) && typeof value === 'object') {
children.push(key);

@@ -214,7 +214,3 @@ }

});
if (value != null) {
_results2.push(attr(element, attribute, value));
} else {
_results2.push(void 0);
}
_results2.push(attr(element, attribute, value));
}

@@ -261,3 +257,3 @@ return _results2;

elementData = data(element);
if (elementData.text === text) {
if (!(text != null) || elementData.text === text) {
return;

@@ -264,0 +260,0 @@ }

// Generated by CoffeeScript 1.3.3
(function(){var e=[].slice,t={}.hasOwnProperty;(function(e,t){return(typeof define!="undefined"&&define!==null?define.amd:void 0)?define(t):(typeof module!="undefined"&&module!==null?module.exports:void 0)?module.exports=t():e.Transparency=t()})(this,function(){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M;return T=function(e){return e.fn.render=function(e,t,n){var r,i,s;for(i=0,s=this.length;i<s;i++)r=this[i],N(r,e,t,n);return this}},n=jQuery,n&&T(n),c="transparency",f=function(e){return e[c]||(e[c]={})},S=function(){},a=function(){var t,n,r,i,s;n=1<=arguments.length?e.call(arguments,0):[],s=[];for(r=0,i=n.length;r<i;r++)t=n[r],s.push(console.log(t));return s},b=S,N=function(e,n,r,i){var s,u,c,h,p,d,v,m,w,T,k,L,A,O,M,_,D,P,H,B,j,F,I,q;b=(i!=null?i.debug:void 0)&&typeof console!="undefined"&&console!==null?a:S,b("Context:",e,"Models:",n,"Directives:",r,"Config:",i);if(!e)return;n||(n=[]),r||(r={}),Array.isArray(n)||(n=[n]),w=e.parentNode,w&&(T=e.nextSibling,w.removeChild(e)),x(e,n),u=f(e);for(p=L=0,_=n.length;L<_;p=++L){m=n[p],s=[],d=u.instances[p],b("Model:",m,"Template instance for the model:",d),F=d.elements;for(A=0,D=F.length;A<D;A++)c=F[A],f(c).model=m;if(g(m)&&(h=d.elements[0]))l(h).appendChild(m);else if(typeof m=="object")for(v in m){if(!t.call(m,v))continue;k=m[v];if(y(k)){I=E(d,v);for(O=0,P=I.length;O<P;O++)h=I[O],h.nodeName.toLowerCase()==="input"?o(h,"value",k):o(h,"text",k)}else typeof k=="object"&&s.push(v)}C(d,m,p,r);for(M=0,H=s.length;M<H;M++){v=s[M],q=E(d,v);for(j=0,B=q.length;j<B;j++)h=q[j],N(h,m[v],r[v],i)}}return w&&(T?w.insertBefore(e,T):w.appendChild(e)),e},x=function(e,t){var n,r,s,o,a,l,c;n=f(e),n.template||(n.template=u(e),n.instanceCache=[],n.instances=[new i(e)]),b("Template",n.template);while(t.length>n.instances.length){r=n.instanceCache.pop()||new i(u(n.template)),l=r.childNodes;for(o=0,a=l.length;o<a;o++)s=l[o],e.appendChild(s);n.instances.push(r)}c=[];while(t.length<n.instances.length)n.instanceCache.push(r=n.instances.pop()),c.push(function(){var e,t,n,i;n=r.childNodes,i=[];for(e=0,t=n.length;e<t;e++)s=n[e],i.push(s.parentNode.removeChild(s));return i}());return c},i=function(){function e(e){this.template=e,this.queryCache={},this.elements=[],this.childNodes=[],p(this.template,this.elements,this.childNodes)}return e}(),p=function(e,t,n){var i,s;i=e.firstChild,s=[];while(i)n!=null&&n.push(i),i.nodeType===r&&(t.push(i),p(i,t)),s.push(i=i.nextSibling);return s},C=function(e,n,r,i){var s,u,a,f,l,c,h;if(!i)return;n=typeof n=="object"?n:{value:n},h=[];for(l in i){if(!t.call(i,l))continue;u=i[l];if(typeof u!="object")throw new Error("Directive syntax is directive[element][attribute] = function(params)");h.push(function(){var t,i,h,p;h=E(e,l),p=[];for(t=0,i=h.length;t<i;t++)f=h[t],p.push(function(){var e;e=[];for(s in u){a=u[s];if(typeof a!="function")continue;c=a.call(n,{element:f,index:r,value:o(f,s)}),c!=null?e.push(o(f,s,c)):e.push(void 0)}return e}());return p}())}return h},k=function(e,t){var n,i,s,o,u,a,c;i=f(e);if(i.html===t)return;i.html=t,i.children||(i.children=function(){var t,n,i,o;i=e.childNodes,o=[];for(t=0,n=i.length;t<n;t++)s=i[t],s.nodeType===r&&o.push(s);return o}()),l(e),e.innerHTML=t,a=i.children,c=[];for(o=0,u=a.length;o<u;o++)n=a[o],c.push(e.appendChild(n));return c},L=function(e,t){var n,r;n=f(e);if(n.text===t)return;return n.text=t,r=e.firstChild,r?r.nodeType!==s?e.insertBefore(e.ownerDocument.createTextNode(t),r):r.nodeValue=t:e.appendChild(e.ownerDocument.createTextNode(t))},d=function(e){var t;return function(){var n,r,i,o;i=e.childNodes,o=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.nodeType===s&&o.push(t.nodeValue);return o}().join("")},o=function(e,t,n){var r,i,s,o,u;n!=null&&typeof n!="string"&&(n=n.toString()),r=f(e),r.originalAttributes||(r.originalAttributes={});switch(t){case"text":(i=r.originalAttributes).text||(i.text=d(e)),n!=null&&L(e,n);break;case"html":(s=r.originalAttributes).html||(s.html=e.innerHTML),n!=null&&k(e,n);break;case"class":(o=r.originalAttributes)["class"]||(o["class"]=e.className),n!=null&&(e.className=n);break;default:(u=r.originalAttributes)[t]||(u[t]=e.getAttribute(t)),n!=null&&e.setAttribute(t,n)}return n!=null?n:r.originalAttributes[t]},E=function(e,t){var n,r,i;return r=(i=e.queryCache)[t]||(i[t]=function(){var r,i,s,o;s=e.elements,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],h.matcher(n,t)&&o.push(n);return o}()),b("Matching elements for '"+t+"':",r),r},w=function(e,t){return e.id===t||e.className.split(" ").indexOf(t)>-1||e.name===t||e.getAttribute("data-bind")===t},l=function(e){var t;while(t=e.firstChild)e.removeChild(t);return e},r=1,s=3,v=function(){return document.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>"},u=typeof document=="undefined"||document===null||v()?function(e){return e.cloneNode(!0)}:function(e){var t,i,s,o,u;t=n(e).clone()[0];if(t.nodeType===r){t.removeAttribute(c),u=t.getElementsByTagName("*");for(s=0,o=u.length;s<o;s++)i=u[s],i.removeAttribute(c)}return t},(O=Array.isArray)==null&&(Array.isArray=function(e){return n.isArray(e)}),(M=(A=Array.prototype).indexOf)==null&&(A.indexOf=function(e){return n.inArray(e,this)}),m=function(e){return Object.prototype.toString.call(e)==="[object Date]"},g=function(e){return(e!=null?e.nodeType:void 0)===r},y=function(e){return m(e)||typeof e!="object"&&typeof e!="function"},h={render:N,register:T,matcher:w}})}).call(this);
(function(){var e=[].slice,t={}.hasOwnProperty;(function(e,t){return(typeof define!="undefined"&&define!==null?define.amd:void 0)?define(t):(typeof module!="undefined"&&module!==null?module.exports:void 0)?module.exports=t():e.Transparency=t()})(this,function(){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M;return T=function(e){return e.fn.render=function(e,t,n){var r,i,s;for(i=0,s=this.length;i<s;i++)r=this[i],N(r,e,t,n);return this}},n=jQuery,n&&T(n),c="transparency",f=function(e){return e[c]||(e[c]={})},S=function(){},a=function(){var t,n,r,i,s;n=1<=arguments.length?e.call(arguments,0):[],s=[];for(r=0,i=n.length;r<i;r++)t=n[r],s.push(console.log(t));return s},b=S,N=function(e,n,r,i){var s,u,c,h,p,d,v,m,w,T,k,L,A,O,M,_,D,P,H,B,j,F,I,q;b=(i!=null?i.debug:void 0)&&typeof console!="undefined"&&console!==null?a:S,b("Context:",e,"Models:",n,"Directives:",r,"Config:",i);if(!e)return;n||(n=[]),r||(r={}),Array.isArray(n)||(n=[n]),w=e.parentNode,w&&(T=e.nextSibling,w.removeChild(e)),x(e,n),u=f(e);for(p=L=0,_=n.length;L<_;p=++L){m=n[p],s=[],d=u.instances[p],b("Model:",m,"Template instance for the model:",d),F=d.elements;for(A=0,D=F.length;A<D;A++)c=F[A],f(c).model=m;if(g(m)&&(h=d.elements[0]))l(h).appendChild(m);else if(typeof m=="object")for(v in m){if(!t.call(m,v))continue;k=m[v];if(k!=null&&y(k)){I=E(d,v);for(O=0,P=I.length;O<P;O++)h=I[O],h.nodeName.toLowerCase()==="input"?o(h,"value",k):o(h,"text",k)}else k!=null&&typeof k=="object"&&s.push(v)}C(d,m,p,r);for(M=0,H=s.length;M<H;M++){v=s[M],q=E(d,v);for(j=0,B=q.length;j<B;j++)h=q[j],N(h,m[v],r[v],i)}}return w&&(T?w.insertBefore(e,T):w.appendChild(e)),e},x=function(e,t){var n,r,s,o,a,l,c;n=f(e),n.template||(n.template=u(e),n.instanceCache=[],n.instances=[new i(e)]),b("Template",n.template);while(t.length>n.instances.length){r=n.instanceCache.pop()||new i(u(n.template)),l=r.childNodes;for(o=0,a=l.length;o<a;o++)s=l[o],e.appendChild(s);n.instances.push(r)}c=[];while(t.length<n.instances.length)n.instanceCache.push(r=n.instances.pop()),c.push(function(){var e,t,n,i;n=r.childNodes,i=[];for(e=0,t=n.length;e<t;e++)s=n[e],i.push(s.parentNode.removeChild(s));return i}());return c},i=function(){function e(e){this.template=e,this.queryCache={},this.elements=[],this.childNodes=[],p(this.template,this.elements,this.childNodes)}return e}(),p=function(e,t,n){var i,s;i=e.firstChild,s=[];while(i)n!=null&&n.push(i),i.nodeType===r&&(t.push(i),p(i,t)),s.push(i=i.nextSibling);return s},C=function(e,n,r,i){var s,u,a,f,l,c,h;if(!i)return;n=typeof n=="object"?n:{value:n},h=[];for(l in i){if(!t.call(i,l))continue;u=i[l];if(typeof u!="object")throw new Error("Directive syntax is directive[element][attribute] = function(params)");h.push(function(){var t,i,h,p;h=E(e,l),p=[];for(t=0,i=h.length;t<i;t++)f=h[t],p.push(function(){var e;e=[];for(s in u){a=u[s];if(typeof a!="function")continue;c=a.call(n,{element:f,index:r,value:o(f,s)}),e.push(o(f,s,c))}return e}());return p}())}return h},k=function(e,t){var n,i,s,o,u,a,c;i=f(e);if(i.html===t)return;i.html=t,i.children||(i.children=function(){var t,n,i,o;i=e.childNodes,o=[];for(t=0,n=i.length;t<n;t++)s=i[t],s.nodeType===r&&o.push(s);return o}()),l(e),e.innerHTML=t,a=i.children,c=[];for(o=0,u=a.length;o<u;o++)n=a[o],c.push(e.appendChild(n));return c},L=function(e,t){var n,r;n=f(e);if(t==null||n.text===t)return;return n.text=t,r=e.firstChild,r?r.nodeType!==s?e.insertBefore(e.ownerDocument.createTextNode(t),r):r.nodeValue=t:e.appendChild(e.ownerDocument.createTextNode(t))},d=function(e){var t;return function(){var n,r,i,o;i=e.childNodes,o=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.nodeType===s&&o.push(t.nodeValue);return o}().join("")},o=function(e,t,n){var r,i,s,o,u;n!=null&&typeof n!="string"&&(n=n.toString()),r=f(e),r.originalAttributes||(r.originalAttributes={});switch(t){case"text":(i=r.originalAttributes).text||(i.text=d(e)),n!=null&&L(e,n);break;case"html":(s=r.originalAttributes).html||(s.html=e.innerHTML),n!=null&&k(e,n);break;case"class":(o=r.originalAttributes)["class"]||(o["class"]=e.className),n!=null&&(e.className=n);break;default:(u=r.originalAttributes)[t]||(u[t]=e.getAttribute(t)),n!=null&&e.setAttribute(t,n)}return n!=null?n:r.originalAttributes[t]},E=function(e,t){var n,r,i;return r=(i=e.queryCache)[t]||(i[t]=function(){var r,i,s,o;s=e.elements,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],h.matcher(n,t)&&o.push(n);return o}()),b("Matching elements for '"+t+"':",r),r},w=function(e,t){return e.id===t||e.className.split(" ").indexOf(t)>-1||e.name===t||e.getAttribute("data-bind")===t},l=function(e){var t;while(t=e.firstChild)e.removeChild(t);return e},r=1,s=3,v=function(){return document.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>"},u=typeof document=="undefined"||document===null||v()?function(e){return e.cloneNode(!0)}:function(e){var t,i,s,o,u;t=n(e).clone()[0];if(t.nodeType===r){t.removeAttribute(c),u=t.getElementsByTagName("*");for(s=0,o=u.length;s<o;s++)i=u[s],i.removeAttribute(c)}return t},(O=Array.isArray)==null&&(Array.isArray=function(e){return n.isArray(e)}),(M=(A=Array.prototype).indexOf)==null&&(A.indexOf=function(e){return n.inArray(e,this)}),m=function(e){return Object.prototype.toString.call(e)==="[object Date]"},g=function(e){return(e!=null?e.nodeType:void 0)===r},y=function(e){return m(e)||typeof e!="object"&&typeof e!="function"},h={render:N,register:T,matcher:w}})}).call(this);
{
"name" : "transparency",
"version" : "0.7.0",
"version" : "0.7.1",
"main" : "lib/transparency",

@@ -5,0 +5,0 @@ "description" : "Transparency is a minimal template engine for browsers. It maps JSON objects to DOM elements with zero configuration.",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc