Socket
Socket
Sign inDemoInstall

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.9.0 to 0.9.1

2

component.json
{
"name": "transparency",
"version": "0.9.0",
"version": "0.9.1",
"main": "./dist/transparency.js"
}
(function() {
var Context, ELEMENT_NODE, Element, Instance, TEXT_NODE, Transparency, VOID_ELEMENTS, chainable, cloneNode, consoleLogger, data, expando, getChildNodes, getElements, html5Clone, isArray, isBoolean, isDate, isDomElement, isPlainValue, log, nullLogger, toString, _getElements, _ref,
var Context, ELEMENT_NODE, Element, ElementFactory, Input, Instance, Select, TEXT_NODE, Transparency, VoidElement, chainable, cloneNode, consoleLogger, data, expando, getChildNodes, getElements, html5Clone, isArray, isBoolean, isDate, isDomElement, isPlainValue, log, nullLogger, toString, _getElements, _ref,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__hasProp = {}.hasOwnProperty,
__slice = [].slice;
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

@@ -29,3 +29,3 @@ Transparency = this.Transparency = {};

context = (_base = data(context)).context || (_base.context = new Context(context));
return context.detach().render(models, directives, options).attach();
return context.detach().render(models, directives, options).attach().el;
};

@@ -86,3 +86,3 @@

Context.prototype.render = chainable(function(models, directives, options) {
var index, instance, model, _i, _len, _results;
var children, index, instance, model, _i, _len, _results;
while (models.length < this.instances.length) {

@@ -98,3 +98,4 @@ this.instanceCache.push(this.instances.pop().remove());

}
_results.push(instance.render(model, index, directives, options));
children = [];
_results.push(instance.prepare(model, children).renderValues(model, children).renderDirectives(model, index, directives).renderChildren(model, children, directives, options));
}

@@ -138,9 +139,3 @@ return _results;

Instance.prototype.render = chainable(function(model, index, directives, options) {
var children;
children = [];
return this.reset(model).renderValues(model, children).renderDirectives(model, index, directives).renderChildren(model, children, directives, options);
});
Instance.prototype.reset = chainable(function(model) {
Instance.prototype.prepare = chainable(function(model) {
var element, _i, _len, _ref, _results;

@@ -174,9 +169,3 @@ _ref = this.elements;

element = _ref[_i];
if (element.nodeName === 'input') {
_results1.push(element.attr('value', value));
} else if (element.nodeName === 'select') {
_results1.push(element.attr('selected', value));
} else {
_results1.push(element.attr('text', value));
}
_results1.push(element.render(value));
}

@@ -198,8 +187,2 @@ return _results1;

var attribute, attributes, directive, element, key, value, _results;
if (!directives) {
return this;
}
model = typeof model === 'object' ? model : {
value: model
};
_results = [];

@@ -220,2 +203,3 @@ for (key in directives) {

for (attribute in attributes) {
if (!__hasProp.call(attributes, attribute)) continue;
directive = attributes[attribute];

@@ -287,38 +271,5 @@ if (!(typeof directive === 'function')) {

getChildNodes = function(el) {
var child, childNodes;
childNodes = [];
child = el.firstChild;
while (child) {
childNodes.push(child);
child = child.nextSibling;
}
return childNodes;
};
getElements = function(el) {
var elements;
elements = [];
_getElements(el, elements);
return elements;
};
_getElements = function(template, elements) {
var child, _results;
child = template.firstChild;
_results = [];
while (child) {
if (child.nodeType === ELEMENT_NODE) {
elements.push(new Element(child));
_getElements(child, elements);
}
_results.push(child = child.nextSibling);
}
return _results;
};
Element = (function() {
function Element(el) {
var _ref;
this.el = el;

@@ -328,3 +279,2 @@ this.childNodes = getChildNodes(this.el);

this.classNames = this.el.className.split(' ');
this.isVoidElement = (_ref = this.nodeName, __indexOf.call(VOID_ELEMENTS, _ref) >= 0);
this.originalAttributes = {};

@@ -352,2 +302,6 @@ }

Element.prototype.render = function(value) {
return this.attr('text', value);
};
Element.prototype.setHtml = function(html) {

@@ -394,64 +348,37 @@ var child, _i, _len, _ref, _results;

Element.prototype.setSelected = function(value) {
var child, childElements, _i, _len, _results;
value = String(value);
childElements = getElements(this.el);
_results = [];
for (_i = 0, _len = childElements.length; _i < _len; _i++) {
child = childElements[_i];
if (child.nodeName === 'option') {
if (child.el.value === value) {
_results.push(child.el.selected = true);
} else {
_results.push(child.el.selected = false);
}
} else {
_results.push(void 0);
}
}
return _results;
};
Element.prototype.attr = function(attribute, value) {
var _base, _base1, _base2, _base3, _base4, _ref, _ref1, _ref2, _ref3, _ref4;
if (this.nodeName === 'select' && attribute === 'selected') {
return this.setSelected(value);
} else {
switch (attribute) {
case 'text':
if (!this.isVoidElement) {
if ((_ref = (_base = this.originalAttributes)['text']) == null) {
_base['text'] = this.getText();
}
return this.setText(value);
switch (attribute) {
case 'text':
if ((_ref = (_base = this.originalAttributes)['text']) == null) {
_base['text'] = this.getText();
}
return this.setText(value);
case 'html':
if ((_ref1 = (_base1 = this.originalAttributes)['html']) == null) {
_base1['html'] = this.el.innerHTML;
}
return this.setHtml(value);
case 'class':
if ((_ref2 = (_base2 = this.originalAttributes)['class']) == null) {
_base2['class'] = this.el.className;
}
return this.el.className = value;
default:
this.el[attribute] = value;
if (isBoolean(value)) {
if ((_ref3 = (_base3 = this.originalAttributes)[attribute]) == null) {
_base3[attribute] = this.el.getAttribute(attribute) || false;
}
break;
case 'html':
if ((_ref1 = (_base1 = this.originalAttributes)['html']) == null) {
_base1['html'] = this.el.innerHTML;
if (value) {
return this.el.setAttribute(attribute, attribute);
} else {
return this.el.removeAttribute(attribute);
}
return this.setHtml(value);
case 'class':
if ((_ref2 = (_base2 = this.originalAttributes)['class']) == null) {
_base2['class'] = this.el.className;
} else {
if ((_ref4 = (_base4 = this.originalAttributes)[attribute]) == null) {
_base4[attribute] = this.el.getAttribute(attribute) || "";
}
return this.el.className = value;
default:
this.el[attribute] = value;
if (isBoolean(value)) {
if ((_ref3 = (_base3 = this.originalAttributes)[attribute]) == null) {
_base3[attribute] = this.el.getAttribute(attribute) || false;
}
if (value) {
return this.el.setAttribute(attribute, attribute);
} else {
return this.el.removeAttribute(attribute);
}
} else {
if ((_ref4 = (_base4 = this.originalAttributes)[attribute]) == null) {
_base4[attribute] = this.el.getAttribute(attribute) || "";
}
return this.el.setAttribute(attribute, value.toString());
}
}
return this.el.setAttribute(attribute, value.toString());
}
}

@@ -464,2 +391,111 @@ };

ElementFactory = {
elements: {},
createElement: function(el) {
var Klass;
Klass = ElementFactory.elements[el.nodeName.toLowerCase()] || Element;
return new Klass(el);
}
};
Select = (function(_super) {
__extends(Select, _super);
function Select() {
return Select.__super__.constructor.apply(this, arguments);
}
ElementFactory.elements.select = Select;
Select.prototype.render = function(value) {
var child, _i, _len, _ref, _results;
value = value.toString();
_ref = getElements(this.el);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
child = _ref[_i];
if (child.nodeName === 'option') {
_results.push(child.el.selected = child.el.value === value);
}
}
return _results;
};
return Select;
})(Element);
VoidElement = (function(_super) {
var VOID_ELEMENTS, nodeName, _i, _len;
__extends(VoidElement, _super);
function VoidElement() {
return VoidElement.__super__.constructor.apply(this, arguments);
}
VOID_ELEMENTS = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
for (_i = 0, _len = VOID_ELEMENTS.length; _i < _len; _i++) {
nodeName = VOID_ELEMENTS[_i];
ElementFactory.elements[nodeName] = VoidElement;
}
VoidElement.prototype.setText = function() {};
return VoidElement;
})(Element);
Input = (function(_super) {
__extends(Input, _super);
function Input() {
return Input.__super__.constructor.apply(this, arguments);
}
ElementFactory.elements.input = Input;
Input.prototype.render = function(value) {
return this.attr('value', value);
};
return Input;
})(VoidElement);
getChildNodes = function(el) {
var child, childNodes;
childNodes = [];
child = el.firstChild;
while (child) {
childNodes.push(child);
child = child.nextSibling;
}
return childNodes;
};
getElements = function(el) {
var elements;
elements = [];
_getElements(el, elements);
return elements;
};
_getElements = function(template, elements) {
var child, _results;
child = template.firstChild;
_results = [];
while (child) {
if (child.nodeType === ELEMENT_NODE) {
elements.push(new ElementFactory.createElement(child));
_getElements(child, elements);
}
_results.push(child = child.nextSibling);
}
return _results;
};
ELEMENT_NODE = 1;

@@ -469,6 +505,4 @@

VOID_ELEMENTS = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
html5Clone = function() {
return document.createElement("nav").cloneNode(true).outerHTML !== "<:nav></:nav>";
return document.createElement('nav').cloneNode(true).outerHTML !== '<:nav></:nav>';
};

@@ -501,5 +535,3 @@

consoleLogger = function() {
var messages;
messages = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return console.log.apply(console, messages);
return console.log(arguments);
};

@@ -506,0 +538,0 @@

@@ -1,4 +0,4 @@

/*! transparency - v0.8.2 - 2013-02-17
/*! transparency - v0.9.0 - 2013-02-17
* https://github.com/leonidas/transparency
* Copyright (c) 2013 Jarno Keskikangas <jarno.keskikangas@leonidasoy.fi>; Licensed MIT */
(function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},C={}.hasOwnProperty,k=[].slice;s=this.Transparency={},s.render=function(t,n,r,i){var s,o;n==null&&(n=[]),r==null&&(r={}),i==null&&(i={}),s=i.debug&&console?f:E,s("Transparency.render:",t,n,r,i);if(!t)return;return v(n)||(n=[n]),t=(o=l(t)).context||(o.context=new e(t)),t.detach().render(n,r,i).attach()},s.jQueryPlugin=function(e,t,n){var r,i,o;for(i=0,o=this.length;i<o;i++)r=this[i],s.render(r,e,t,n);return this},s.matcher=function(e,t){return e.el.id===t||N.call(e.classNames,t)>=0||e.el.name===t||e.el.getAttribute("data-bind")===t},s.clone=function(e){var t;return typeof (t=jQuery||Zepto)=="function"?t(e).clone()[0]:void 0},u=function(e){return function(){return e.apply(this,arguments),this}},e=function(){function e(e){this.el=e,this.template=a(this.el),this.instances=[new r(this.el)],this.instanceCache=[]}return e.prototype.detach=u(function(){this.parent=this.el.parentNode;if(this.parent)return this.nextSibling=this.el.nextSibling,this.parent.removeChild(this.el)}),e.prototype.attach=u(function(){if(this.parent)return this.nextSibling?this.parent.insertBefore(this.el,this.nextSibling):this.parent.appendChild(this.el)}),e.prototype.render=u(function(e,t,n){var i,s,o,u,f,l;while(e.length<this.instances.length)this.instanceCache.push(this.instances.pop().remove());l=[];for(i=u=0,f=e.length;u<f;i=++u)o=e[i],(s=this.instances[i])||(s=this.instanceCache.pop()||new r(a(this.template)),this.instances.push(s.appendTo(this.el))),l.push(s.render(o,i,t,n));return l}),e}(),r=function(){function e(e){this.queryCache={},this.childNodes=h(e),this.elements=p(e)}return e.prototype.remove=u(function(){var e,t,n,r,i;r=this.childNodes,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(e.parentNode.removeChild(e));return i}),e.prototype.appendTo=u(function(e){var t,n,r,i,s;i=this.childNodes,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],s.push(e.appendChild(t));return s}),e.prototype.render=u(function(e,t,n,r){var i;return i=[],this.reset(e).renderValues(e,i).renderDirectives(e,t,n).renderChildren(e,i,n,r)}),e.prototype.reset=u(function(e){var t,n,r,i,s;i=this.elements,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.reset(),s.push(l(t.el).model=e);return s}),e.prototype.renderValues=u(function(e,t){var n,r,i,s;if(y(e)&&(n=this.elements[0]))return n.empty().el.appendChild(e);if(typeof e=="object"){s=[];for(r in e){if(!C.call(e,r))continue;i=e[r],i!=null&&(b(i)?s.push(function(){var e,t,s,o;s=this.matchingElements(r),o=[];for(e=0,t=s.length;e<t;e++)n=s[e],n.nodeName==="input"?o.push(n.attr("value",i)):n.nodeName==="select"?o.push(n.attr("selected",i)):o.push(n.attr("text",i));return o}.call(this)):typeof i=="object"?s.push(t.push(r)):s.push(void 0))}return s}}),e.prototype.renderDirectives=u(function(e,t,n){var r,i,s,o,u,a,f;if(!n)return this;e=typeof e=="object"?e:{value:e},f=[];for(u in n){if(!C.call(n,u))continue;i=n[u],typeof i=="object"&&f.push(function(){var n,f,l,c;l=this.matchingElements(u),c=[];for(n=0,f=l.length;n<f;n++)o=l[n],c.push(function(){var n;n=[];for(r in i){s=i[r];if(typeof s!="function")continue;a=s.call(e,{element:o.el,index:t,value:o.originalAttributes[r]}),a!=null?n.push(o.attr(r,a)):n.push(void 0)}return n}());return c}.call(this))}return f}),e.prototype.renderChildren=u(function(e,t,n,r){var i,o,u,a,f;f=[];for(u=0,a=t.length;u<a;u++)o=t[u],f.push(function(){var t,u,a,f;a=this.matchingElements(o),f=[];for(t=0,u=a.length;t<u;t++)i=a[t],f.push(s.render(i.el,e[o],n[o],r));return f}.call(this));return f}),e.prototype.matchingElements=function(e){var t,n,r;return n=(r=this.queryCache)[e]||(r[e]=function(){var n,r,i,o;i=this.elements,o=[];for(n=0,r=i.length;n<r;n++)t=i[n],s.matcher(t,e)&&o.push(t);return o}.call(this)),w("Matching elements for '"+e+"':",n),n},e}(),h=function(e){var t,n;n=[],t=e.firstChild;while(t)n.push(t),t=t.nextSibling;return n},p=function(e){var t;return t=[],x(e,t),t},x=function(e,r){var i,s;i=e.firstChild,s=[];while(i)i.nodeType===t&&(r.push(new n(i)),x(i,r)),s.push(i=i.nextSibling);return s},n=function(){function e(e){var t;this.el=e,this.childNodes=h(this.el),this.nodeName=this.el.nodeName.toLowerCase(),this.classNames=this.el.className.split(" "),this.isVoidElement=(t=this.nodeName,N.call(o,t)>=0),this.originalAttributes={}}return e.prototype.empty=function(){var e;while(e=this.el.firstChild)this.el.removeChild(e);return this},e.prototype.reset=function(){var e,t,n,r;n=this.originalAttributes,r=[];for(e in n)t=n[e],r.push(this.attr(e,t));return r},e.prototype.setHtml=function(e){var t,n,r,i,s;this.empty(),this.el.innerHTML=e,i=this.childNodes,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],s.push(this.el.appendChild(t));return s},e.prototype.setText=function(e){var t;return t=this.el.firstChild,t?t.nodeType!==i?this.el.insertBefore(this.el.ownerDocument.createTextNode(e),t):t.nodeValue=e:this.el.appendChild(this.el.ownerDocument.createTextNode(e))},e.prototype.getText=function(){var e;return function(){var t,n,r,s;r=this.childNodes,s=[];for(t=0,n=r.length;t<n;t++)e=r[t],e.nodeType===i&&s.push(e.nodeValue);return s}.call(this).join("")},e.prototype.setSelected=function(e){var t,n,r,i,s;e=String(e),n=p(this.el),s=[];for(r=0,i=n.length;r<i;r++)t=n[r],t.nodeName==="option"?t.el.value===e?s.push(t.el.selected=!0):s.push(t.el.selected=!1):s.push(void 0);return s},e.prototype.attr=function(e,t){var n,r,i,s,o,u,a,f,l,c;if(this.nodeName==="select"&&e==="selected")return this.setSelected(t);switch(e){case"text":if(!this.isVoidElement)return(u=(n=this.originalAttributes)["text"])==null&&(n.text=this.getText()),this.setText(t);break;case"html":return(a=(r=this.originalAttributes)["html"])==null&&(r.html=this.el.innerHTML),this.setHtml(t);case"class":return(f=(i=this.originalAttributes)["class"])==null&&(i["class"]=this.el.className),this.el.className=t;default:return this.el[e]=t,m(t)?((l=(s=this.originalAttributes)[e])==null&&(s[e]=this.el.getAttribute(e)||!1),t?this.el.setAttribute(e,e):this.el.removeAttribute(e)):((c=(o=this.originalAttributes)[e])==null&&(o[e]=this.el.getAttribute(e)||""),this.el.setAttribute(e,t.toString()))}},e}(),t=1,i=3,o=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],d=function(){return document.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>"},a=typeof document=="undefined"||document===null||d()?function(e){return e.cloneNode(!0)}:function(e){var n,r,i,o,u;n=s.clone(e);if(n.nodeType===t){n.removeAttribute(c),u=n.getElementsByTagName("*");for(i=0,o=u.length;i<o;i++)r=u[i],r.removeAttribute(c)}return n},c="transparency",l=function(e){return e[c]||(e[c]={})},E=function(){},f=function(){var e;return e=1<=arguments.length?k.call(arguments,0):[],console.log.apply(console,e)},w=E,S=Object.prototype.toString,g=function(e){return S.call(e)==="[object Date]"},y=function(e){return e.nodeType===t},b=function(e){var t;return t=typeof e,t!=="object"&&t!=="function"||g(e)},m=function(e){return e===!0||e===!1},v=Array.isArray||function(e){return S.call(e)==="[object Array]"},(T=jQuery||Zepto)!=null&&(T.fn.render=s.jQueryPlugin),(typeof define!="undefined"&&define!==null?define.amd:void 0)&&define(function(){return s})}).call(this);
(function(){var e,t,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=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},A={}.hasOwnProperty,O=function(e,t){function r(){this.constructor=e}for(var n in t)A.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};a=this.Transparency={},a.render=function(t,n,r,i){var s,o;n==null&&(n=[]),r==null&&(r={}),i==null&&(i={}),s=i.debug&&console?h:T,s("Transparency.render:",t,n,r,i);if(!t)return;return y(n)||(n=[n]),t=(o=p(t)).context||(o.context=new e(t)),t.detach().render(n,r,i).attach().el},a.jQueryPlugin=function(e,t,n){var r,i,s;for(i=0,s=this.length;i<s;i++)r=this[i],a.render(r,e,t,n);return this},a.matcher=function(e,t){return e.el.id===t||L.call(e.classNames,t)>=0||e.el.name===t||e.el.getAttribute("data-bind")===t},a.clone=function(e){var t;return typeof (t=jQuery||Zepto)=="function"?t(e).clone()[0]:void 0},l=function(e){return function(){return e.apply(this,arguments),this}},e=function(){function e(e){this.el=e,this.template=c(this.el),this.instances=[new s(this.el)],this.instanceCache=[]}return e.prototype.detach=l(function(){this.parent=this.el.parentNode;if(this.parent)return this.nextSibling=this.el.nextSibling,this.parent.removeChild(this.el)}),e.prototype.attach=l(function(){if(this.parent)return this.nextSibling?this.parent.insertBefore(this.el,this.nextSibling):this.parent.appendChild(this.el)}),e.prototype.render=l(function(e,t,n){var r,i,o,u,a,f,l;while(e.length<this.instances.length)this.instanceCache.push(this.instances.pop().remove());l=[];for(i=a=0,f=e.length;a<f;i=++a)u=e[i],(o=this.instances[i])||(o=this.instanceCache.pop()||new s(c(this.template)),this.instances.push(o.appendTo(this.el))),r=[],l.push(o.prepare(u,r).renderValues(u,r).renderDirectives(u,i,t).renderChildren(u,r,t,n));return l}),e}(),s=function(){function e(e){this.queryCache={},this.childNodes=v(e),this.elements=m(e)}return e.prototype.remove=l(function(){var e,t,n,r,i;r=this.childNodes,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],i.push(e.parentNode.removeChild(e));return i}),e.prototype.appendTo=l(function(e){var t,n,r,i,s;i=this.childNodes,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],s.push(e.appendChild(t));return s}),e.prototype.prepare=l(function(e){var t,n,r,i,s;i=this.elements,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.reset(),s.push(p(t.el).model=e);return s}),e.prototype.renderValues=l(function(e,t){var n,r,i,s;if(E(e)&&(n=this.elements[0]))return n.empty().el.appendChild(e);if(typeof e=="object"){s=[];for(r in e){if(!A.call(e,r))continue;i=e[r],i!=null&&(S(i)?s.push(function(){var e,t,s,o;s=this.matchingElements(r),o=[];for(e=0,t=s.length;e<t;e++)n=s[e],o.push(n.render(i));return o}.call(this)):typeof i=="object"?s.push(t.push(r)):s.push(void 0))}return s}}),e.prototype.renderDirectives=l(function(e,t,n){var r,i,s,o,u,a,f;f=[];for(u in n){if(!A.call(n,u))continue;i=n[u],typeof i=="object"&&f.push(function(){var n,f,l,c;l=this.matchingElements(u),c=[];for(n=0,f=l.length;n<f;n++)o=l[n],c.push(function(){var n;n=[];for(r in i){if(!A.call(i,r))continue;s=i[r];if(typeof s!="function")continue;a=s.call(e,{element:o.el,index:t,value:o.originalAttributes[r]}),a!=null?n.push(o.attr(r,a)):n.push(void 0)}return n}());return c}.call(this))}return f}),e.prototype.renderChildren=l(function(e,t,n,r){var i,s,o,u,f;f=[];for(o=0,u=t.length;o<u;o++)s=t[o],f.push(function(){var t,o,u,f;u=this.matchingElements(s),f=[];for(t=0,o=u.length;t<o;t++)i=u[t],f.push(a.render(i.el,e[s],n[s],r));return f}.call(this));return f}),e.prototype.matchingElements=function(e){var t,n,r;return n=(r=this.queryCache)[e]||(r[e]=function(){var n,r,i,s;i=this.elements,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],a.matcher(t,e)&&s.push(t);return s}.call(this)),x("Matching elements for '"+e+"':",n),n},e}(),n=function(){function e(e){this.el=e,this.childNodes=v(this.el),this.nodeName=this.el.nodeName.toLowerCase(),this.classNames=this.el.className.split(" "),this.originalAttributes={}}return e.prototype.empty=function(){var e;while(e=this.el.firstChild)this.el.removeChild(e);return this},e.prototype.reset=function(){var e,t,n,r;n=this.originalAttributes,r=[];for(e in n)t=n[e],r.push(this.attr(e,t));return r},e.prototype.render=function(e){return this.attr("text",e)},e.prototype.setHtml=function(e){var t,n,r,i,s;this.empty(),this.el.innerHTML=e,i=this.childNodes,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],s.push(this.el.appendChild(t));return s},e.prototype.setText=function(e){var t;return t=this.el.firstChild,t?t.nodeType!==u?this.el.insertBefore(this.el.ownerDocument.createTextNode(e),t):t.nodeValue=e:this.el.appendChild(this.el.ownerDocument.createTextNode(e))},e.prototype.getText=function(){var e;return function(){var t,n,r,i;r=this.childNodes,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],e.nodeType===u&&i.push(e.nodeValue);return i}.call(this).join("")},e.prototype.attr=function(e,t){var n,r,i,s,o,u,a,f,l,c;switch(e){case"text":return(u=(n=this.originalAttributes)["text"])==null&&(n.text=this.getText()),this.setText(t);case"html":return(a=(r=this.originalAttributes)["html"])==null&&(r.html=this.el.innerHTML),this.setHtml(t);case"class":return(f=(i=this.originalAttributes)["class"])==null&&(i["class"]=this.el.className),this.el.className=t;default:return this.el[e]=t,b(t)?((l=(s=this.originalAttributes)[e])==null&&(s[e]=this.el.getAttribute(e)||!1),t?this.el.setAttribute(e,e):this.el.removeAttribute(e)):((c=(o=this.originalAttributes)[e])==null&&(o[e]=this.el.getAttribute(e)||""),this.el.setAttribute(e,t.toString()))}},e}(),r={elements:{},createElement:function(e){var t;return t=r.elements[e.nodeName.toLowerCase()]||n,new t(e)}},o=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return O(t,e),r.elements.select=t,t.prototype.render=function(e){var t,n,r,i,s;e=e.toString(),i=m(this.el),s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t.nodeName==="option"&&s.push(t.el.selected=t.el.value===e);return s},t}(n),f=function(e){function o(){return o.__super__.constructor.apply(this,arguments)}var t,n,i,s;O(o,e),t=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];for(i=0,s=t.length;i<s;i++)n=t[i],r.elements[n]=o;return o.prototype.setText=function(){},o}(n),i=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return O(t,e),r.elements.input=t,t.prototype.render=function(e){return this.attr("value",e)},t}(f),v=function(e){var t,n;n=[],t=e.firstChild;while(t)n.push(t),t=t.nextSibling;return n},m=function(e){var t;return t=[],C(e,t),t},C=function(e,n){var i,s;i=e.firstChild,s=[];while(i)i.nodeType===t&&(n.push(new r.createElement(i)),C(i,n)),s.push(i=i.nextSibling);return s},t=1,u=3,g=function(){return document.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>"},c=typeof document=="undefined"||document===null||g()?function(e){return e.cloneNode(!0)}:function(e){var n,r,i,s,o;n=a.clone(e);if(n.nodeType===t){n.removeAttribute(d),o=n.getElementsByTagName("*");for(i=0,s=o.length;i<s;i++)r=o[i],r.removeAttribute(d)}return n},d="transparency",p=function(e){return e[d]||(e[d]={})},T=function(){},h=function(){return console.log(arguments)},x=T,N=Object.prototype.toString,w=function(e){return N.call(e)==="[object Date]"},E=function(e){return e.nodeType===t},S=function(e){var t;return t=typeof e,t!=="object"&&t!=="function"||w(e)},b=function(e){return e===!0||e===!1},y=Array.isArray||function(e){return N.call(e)==="[object Array]"},(k=jQuery||Zepto)!=null&&(k.fn.render=a.jQueryPlugin),(typeof define!="undefined"&&define!==null?define.amd:void 0)&&define(function(){return a})}).call(this);
{
"name": "transparency",
"version": "0.9.0",
"version": "0.9.1",
"main": "dist/transparency",

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

@@ -185,3 +185,3 @@ # Synopsis

Access to the plain values within the directives is provided through `this.value`. There's a whole
Access to the plain values within the directives is provided through `this`. There's a whole
lot more to say about the directives, but that's all we need for now. For the details, see

@@ -211,3 +211,3 @@ section [Directives](https://github.com/leonidas/transparency#directives).

text: function() {
return this.value;
return this;
}

@@ -214,0 +214,0 @@ }

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

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