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

elements-lite

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elements-lite - npm Package Compare versions

Comparing version 0.3.5 to 0.3.8

lib/ie.js

1

createTextNode.md
/*
http://docs.emmet.io/
* template:

@@ -3,0 +4,0 @@ * https://github.com/Shopify/liquid/wiki/Liquid-for-Designers

22

dist/index-min.js
/*
MIT License
*/
!function(r,g,s){function f(a,b,c){var d,e={};a=a.replace(z,function(a,b,c,d,f){e["."==b?(b="class",e[b]&&(c=e[b]+" "+c),b):"#"==b?"id":c]=(f?d.slice(1,-1):d)||c;return""})||"div";d=(n[a]||(n[a]=g.createElement(a))).cloneNode(!0).set(e);return c?(h[a]&&d.setAttribute("data-call",a),d):h[a]&&h[a].call(d,b)||d.set(b)}function m(a,b){if(a){if("string"==typeof a||"number"==typeof a)a=f.text(a);else if(!("nodeType"in a)&&"length"in a){for(var c=a.length,d=0,e=g.createDocumentFragment();d<c;)m.call(e,a[d++]);
a=e}a.nodeType&&this.insertBefore(a,(!0===b?this.firstChild:"number"==typeof b?this.childNodes[0>b?this.childNodes.length-b-2:b]:b)||null);a.appendHook&&a.appendHook()}return this}function t(a){return-1<(" "+this.className+" ").indexOf(" "+a+" ")}function u(a){this.className+=this.className?t.call(this,a)?"":" "+a:a;return this}function A(a){this.className=(" "+this.className+" ").replace(" "+a+" "," ").trim();return this}function B(){this.parentNode&&this.parentNode.removeChild(this);Event.removeAll&&
Event.removeAll(this);this.killHook&&this.killHook();this.empty&&this.empty();return this}function F(a){var b,c=a._childs;if(!c)for(a._childs=c=[];b=a.firstChild;)c.push(b),a.removeChild(b);return c}function p(a,b){var c,d=this;if(c=!b&&d.getAttribute("data-call"))d.removeAttribute("data-call"),h[c].call(d);if(c=!b&&d.getAttribute("data-bind"))if(d.getAttribute("lang"),"{"==c.charAt(0)&&(c='txt:"'+c.replace(/"/g,'\\"')+'"'),c="n d p r->d&&("+c.replace(G,"(p['$1']?(r=p['$1'](n,d,$2)||r):(n['$1']=$2.format(d))),")+
"r)",c.fn()(d,a,H))return d;for(d=d.firstChild;d;d=d.nextSibling)1==d.nodeType&&p.call(d,a);return this}function C(a,b,c){var d=0,e=[],f=["_"];b=b.replace(z,function(a,b,c,d){f.push("."==b?"(' '+_.className+' ').indexOf(' "+c+" ')>-1":"#"==b?"_.id=='"+c+"'":"_.getAttribute('"+c+"')"+(d?"=='"+d+"'":""));return""})||"*";b=a.getElementsByTagName(b);for(var g=Fn(f.join("&&"));a=b[d++];)if(g(a)){if(c)return a;e.push(a)}return c?null:e}function v(a){this._nodes=a}function w(a,b){if(a)for(b in e)a[b]=e[b];
return a}function x(a,b,c){n[a]="string"==typeof b?f(b):b;c&&(h[a]=c)}function q(a){function b(a,c,g,h,k,l){for(k=c.length;k<=e[0];)e.shift(),d=d.plugin?d.plugin.done():d.parentNode;g?q.plugins[h]?(d=(new q.plugins[h](d,l)).el,e.unshift(k)):d.append(f.text("text"==h?l:a)):(h&&(d=f(h,0,1).to(d),e.unshift(k)),l&&(k=l.charAt(0),">"==k?(c+" "+l.slice(1)).replace(D,b):"="==k?d.set({"data-bind":l.slice(1)}):d.append(l.replace(/\\([=>:])/g,"$1"))))}var c=g.createDocumentFragment(),d=c,e=[-1];a.replace(D,
b);c=c.childNodes;if(1==c.length)return c[0];e=[];for(d=c.length;d--;)e[d]=c[d];return e}function y(a,b){this.name=b;this.parent=a;this.el=f("div");this.el.plugin=this;return this}var n={},h={},E=g.createElement,e=(r.HTMLElement||r.Element||f)[s],z=/([.#:[])([-\w]+)(?:=((["'\/])(?:\\.|.)*?\4|[-\w]+)])?]?/g,D=/^([ \t]*)(\:?)((?:(["'\/])(?:\\.|.)*?\4|[-\w\:.#\[\]=])+)[ \t]*(.*)$/gm,G=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\.|.)*?\3|[-,\s\w])*))?/g,H=f.bindings={txt:function(a,b,c){a.txt(c.format(b))},
"class":function(a,b,c,d){a.toggleClass(c,d.fn("_")(b))},html:function(a,b,c){a.innerHTML=c.format(b)},each:function(a,b,c){var d=F(a);c&&a.empty().append(c.map(function(a){return d.map(function(b){return p.call(b.cloneNode(!0),a)})}));return a}};r.El=f;e.append=m;e.after=function(a,b){m.call(a.parentNode,this,b?a:a.nextSibling);return this};e.to=function(a,b){m.call(a,this,b);return this};e.hasClass=t;e.addClass=u;e.rmClass=A;e.toggleClass=function(a,b){1==arguments.length&&(b=!t.call(this,a));return(b?
u:A).call(this,a),b};e.empty=function(){for(var a;a=this.firstChild;)B.call(a);return this};e.kill=B;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.set=function(a){var b,c=typeof a;if(!a)return this;if("string"==c||"number"==c||a.nodeType||"length"in a)m.call(this,a);else for(c in a)b=a[c],"class"==c?u.call(this,b):b?"string"==typeof b?(this.setAttribute(c,b),"id"!=c&&"name"!=c||"\v"!="v"||this.mergeAttributes(E("<INPUT "+c+'="'+b+'"/>'),
!1)):this[c]=b:this.removeAttribute(c);return this};e.render=p;e.txt=function(a){var b="textContent"in this?"textContent":"innerText";return arguments.length?this[b]=a:this[b]};e.find="\v"!=="v"&&e.querySelector||function(a){return C(this,a,!0)};e.findAll=e.querySelectorAll?function(a){return new v(this.querySelectorAll(a))}:function(a){return new v(C(this,a))};v.prototype=Object.keys(e).reduce(function(a,b){a[b]=function(){for(var a=this._nodes,d=0,f=a.length;d<f;)e[b].apply(a[d++],arguments);return this};
return a},{});e===f[s]&&(g.createElement=function(a){return w(E(a))},w(g.body));f[s]=e;f.get=function(a){"string"==typeof a&&(a=g.getElementById(a));return a&&a.to?a:w(a)};x._el=n;x._fn=h;f.cache=x;f.text=function(a){return g.createTextNode(a)};y.prototype.done=function(){f.cache(this.name,this.el.removeChild(this.el.firstChild),p);this.el.plugin=null;return this.parent};q.plugins={template:y};f.tpl=function(a){return q(a).render()};f.include=function(a,b,c){b=f.get(a);(new y(null,a)).el.append(f.tpl(b.innerHTML)).plugin.done();
b.kill()}}(window,document,"prototype");
!function(u,h,v){function f(a,b,c){var d,e={};a=a.replace(C,function(a,b,c,d,f){e["."==b?(b="class",e[b]&&(c=e[b]+" "+c),b):"#"==b?"id":c]=(f?d.slice(1,-1):d)||c;return""})||"div";d=(q[a]||(q[a]=h.createElement(a))).cloneNode(!0).set(e);return c?(m[a]&&d.setAttribute("data-call",a),d):m[a]&&m[a].call(d,b)||d.set(b)}function n(a,b){if(a){if("string"==typeof a||"number"==typeof a)a=f.text(a);else if(!("nodeType"in a)&&"length"in a){for(var c=a.length,d=0,e=h.createDocumentFragment();d<c;)n.call(e,a[d++]);
a=e}a.nodeType&&this.insertBefore(a,(!0===b?this.firstChild:"number"==typeof b?this.childNodes[0>b?this.childNodes.length-b-2:b]:b)||null);a.appendHook&&a.appendHook()}return this}function w(a){return-1<(" "+this.className+" ").indexOf(" "+a+" ")}function x(a){this.className+=this.className?w.call(this,a)?"":" "+a:a;return this}function D(a){this.className=(" "+this.className+" ").replace(" "+a+" "," ").trim();return this}function E(){this.parentNode&&this.parentNode.removeChild(this);Event.removeAll&&
Event.removeAll(this);this.killHook&&this.killHook();this.empty&&this.empty();return this}function J(a){var b,c=a._childs;if(!c)for(a._childs=c=[];b=a.firstChild;)c.push(b),a.removeChild(b);return c}function r(a,b){var c,d=this;if(c=!b&&d.getAttribute("data-call"))d.removeAttribute("data-call"),m[c].call(d);if(c=!b&&d.getAttribute("data-bind"))if(d.getAttribute("lang"),"{"==c.charAt(0)&&(c='txt:"'+c.replace(/"/g,'\\"')+'"'),c="n d p r->d&&("+c.replace(K,"(p['$1']?(r=p['$1'](n,d,$2)||r):(n['$1']=$2.format(d))),")+
"r)",c.fn()(d,a,L))return d;for(d=d.firstChild;d;d=d.nextSibling)1==d.nodeType&&r.call(d,a);return this}function F(a,b,c){var d=0,e=[],f=["_"];b=b.replace(C,function(a,b,c,d){f.push("."==b?"(' '+_.className+' ').indexOf(' "+c+" ')>-1":"#"==b?"_.id=='"+c+"'":"_.getAttribute('"+c+"')"+(d?"=='"+d+"'":""));return""})||"*";b=a.getElementsByTagName(b);for(var g=Fn(f.join("&&"));a=b[d++];)if(g(a)){if(c)return a;e.push(a)}return c?null:e}function s(a){this._nodes=a}function y(a,b){if(a)for(b in e)a[b]=e[b];
return a}function z(a,b,c){q[a]="string"==typeof b?f(b):b;c&&(m[a]=c)}function t(a){function b(a,c,g,h,k,l){for(k=c.length;k<=e[0];)e.shift(),d=d.plugin?d.plugin.done():d.parentNode;g?t.plugins[h]?(d=(new t.plugins[h](d,l)).el,e.unshift(k)):d.append(f.text("text"==h?l:a)):(h&&(d=f(h,0,1).to(d),e.unshift(k)),l&&(k=l.charAt(0),">"==k?(c+" "+l.slice(1)).replace(G,b):"="==k?d.set({"data-bind":l.slice(1)}):d.append(l.replace(/\\([=>:])/g,"$1"))))}var c=h.createDocumentFragment(),d=c,e=[-1];a.replace(G,
b);c=c.childNodes;if(1==c.length)return c[0];e=[];for(d=c.length;d--;)e[d]=c[d];return e}function A(a,b){this.name=b;this.parent=a;this.el=f("div");this.el.plugin=this;return this}function g(a,b){return g[b?B(b):p][a]||a}function B(a){if(!a)return p;a=(a||"").toLowerCase();return g[a]?a:(a=a.split("-")[0],g[a])?a:p}function H(a,b){Object.merge(g[a]||(g[a]={}),b)}var p,q={},m={},I=h.createElement,e=(u.HTMLElement||u.Element||f)[v],C=/([.#:[])([-\w]+)(?:=((["'\/])(?:\\?.)*?\4|[-\w]+)])?]?/g,G=/^([ \t]*)(\:?)((?:(["'\/])(?:\\?.)*?\4|[-\w\:.#\[\]=])+)[ \t]*(.*)$/gm,
K=/[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[-,\s\w])*))?/g,L=f.bindings={txt:function(a,b,c){a.txt(c.format(b))},"class":function(a,b,c,d){a.toggleClass(c,d.fn("_")(b))},html:function(a,b,c){a.innerHTML=c.format(b)},each:function(a,b,c){var d=J(a);c&&a.empty().append(c.map(function(a){return d.map(function(b){return r.call(b.cloneNode(!0),a)})}));return a}};u.El=f;e.append=n;e.after=function(a,b){n.call(a.parentNode,this,b?a:a.nextSibling);return this};e.to=function(a,b){n.call(a,this,b);return this};
e.hasClass=w;e.addClass=x;e.rmClass=D;e.toggleClass=function(a,b){1==arguments.length&&(b=!w.call(this,a));return(b?x:D).call(this,a),b};e.empty=function(){for(var a;a=this.firstChild;)E.call(a);return this};e.kill=E;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.set=function(a){var b,c=typeof a;if(!a)return this;if("string"==c||"number"==c||a.nodeType||"length"in a)n.call(this,a);else for(c in a)b=a[c],"class"==c?x.call(this,b):b?"string"==
typeof b?(this.setAttribute(c,b),"id"!=c&&"name"!=c||"\v"!="v"||this.mergeAttributes(I("<INPUT "+c+'="'+b+'"/>'),!1)):this[c]=b:this.removeAttribute(c);return this};e.render=r;e.txt=function(a){var b="textContent"in this?"textContent":"innerText";return arguments.length?this[b]=a:this[b]};e.find="\v"!=="v"&&e.querySelector||function(a){return F(this,a,!0)};e.findAll=e.querySelectorAll?function(a){return new s(this.querySelectorAll(a))}:function(a){return new s(F(this,a))};f.wrap=s;s.prototype=Object.keys(e).reduce(function(a,
b){a[b]=function(){for(var a=this._nodes,d=0,f=a.length;d<f;)e[b].apply(a[d++],arguments);return this};return a},{});e===f[v]&&(h.createElement=function(a){return y(I(a))},y(h.body));f[v]=e;f.get=function(a){"string"==typeof a&&(a=h.getElementById(a));return a&&a.to?a:y(a)};z._el=q;z._fn=m;f.cache=z;f.text=function(a){return h.createTextNode(a)};A.prototype.done=function(){f.cache(this.name,this.el.removeChild(this.el.firstChild),r);this.el.plugin=null;return this.parent};t.plugins={template:A};f.create=
f.tpl=function(a){return t(a).render()};f.include=function(a,b,c){b=f.get(a);(new A(null,a)).el.append(f.tpl(b.innerHTML)).plugin.done();b.kill()};f.i18n=g;g.get=B;g.use=function(a){a=B(a);p!=(p=a)&&(g[a]=g[a]||{});return h.documentElement.lang=a};g.add=H;g.def=function(a){Object.each(a,function(b,c){H(c,a)})}}(window,document,"prototype");

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

/*
MIT License
*/
!function(d){function a(){var a=c.offsetWidth,b=601>a?"s-mob":1025>a?"s-tab":"s-full";b!=e&&(c.addClass(b).rmClass(e),e=b);b=a>c.offsetHeight?"s-land":"s-port";b!=f&&(c.addClass(b).rmClass(f),f=b);g()}var e,f,c=document.body,g=function(){d.M&&M.emit("resize")}.rate(200,!0);a();Event.add(d,"resize",a);Event.add(c,"orientationchange",a);Event.add(d,"load",a)}(this);

@@ -5,4 +5,4 @@

/**
* @version 0.3.5
* @date 2014-09-15
* @version 0.3.8
* @date 2014-09-19
* @stability 1 - Experimental

@@ -15,14 +15,11 @@ * @author Lauri Rooden <lauri@rooden.ee>

// TODO: find ways for automated testing
// http://www.browserscope.org/user/tests/howto
!function(window, document, protoStr) {
var elCache = {}
var currentLang
, elCache = {}
, fnCache = {}
, createElement = document.createElement
, proto = (window.HTMLElement || window.Element || El)[protoStr]
, elRe = /([.#:[])([-\w]+)(?:=((["'\/])(?:\\.|.)*?\4|[-\w]+)])?]?/g
, tplRe = /^([ \t]*)(\:?)((?:(["'\/])(?:\\.|.)*?\4|[-\w\:.#\[\]=])+)[ \t]*(.*)$/gm
, renderRe = /[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\.|.)*?\3|[-,\s\w])*))?/g
, elRe = /([.#:[])([-\w]+)(?:=((["'\/])(?:\\?.)*?\4|[-\w]+)])?]?/g
, tplRe = /^([ \t]*)(\:?)((?:(["'\/])(?:\\?.)*?\4|[-\w\:.#\[\]=])+)[ \t]*(.*)$/gm
, renderRe = /[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[-,\s\w])*))?/g
, bindings = El.bindings = {

@@ -38,11 +35,2 @@ "txt": function(node, data, text) {

},
/**
"with": function(node, data, scope) {
render.call(node, scope, true)
},
"if": function(node, data, fn) {
var childs = getChilds(node)
node.empty().append( fn.fn("_")(data) && childs )
},
//*/
"each": function(node, data, arr) {

@@ -89,28 +77,2 @@ var childs = getChilds(node)

// TODO: Extend El api
// add El.siblings( [selector ] )
// add El.children( [selector ] )
// add El.invoke
// https://github.com/WebReflection/dom4#dom4
//
// How elements.js extends the DOM
// -------------------------------
//
// All DOM extensions on the element are available by default.
//
// In browsers that does not support adding methods to prototype of native objects
// such as HTMLElement or Element, document.createElement will be overrided
// to extend created elements. El.get() and element.find will extend
// returned elements.
// ### element.append( content, [ before ] ) -> element
//
// - **content** `element || Array || String || Number`
// - **before** `optional`
// - true - Insert content to the beginning of element
// - element - Insert content before specified element
// - Number - Insert content before nth child
function append(child, before) {

@@ -291,4 +253,3 @@ var el = this

// textContent is suported from IE9
//
// Opera 9-10 have Node.text, Node.textContent
// Opera 9-10 have Node.text so we use Node.txt

@@ -301,5 +262,2 @@ proto.txt = function(newText) {

// NOTE: fast selectors for IE
// http://ajaxian.com/archives/creating-a-queryselector-for-ie-that-runs-at-native-speed
function findEl(node, sel, first) {

@@ -335,17 +293,16 @@ var el

function(sel) {
return new ElAll(this.querySelectorAll(sel))
return new ElWrap(this.querySelectorAll(sel))
} :
function(sel) {
return new ElAll(findEl(this, sel))
return new ElWrap(findEl(this, sel))
}
// TODO:2014-09-13:lauri:Expose ElAll
function ElAll(nodes) {
function ElWrap(nodes) {
this._nodes = nodes
}
El.wrap = ElWrap
ElAll.prototype = Object.keys(proto).reduce(function(memo, key) {
ElWrap.prototype = Object.keys(proto).reduce(function(memo, key) {
memo[key] = function() {
var elAll = this
, nodes = elAll._nodes
var nodes = this._nodes
, i = 0

@@ -356,3 +313,3 @@ , len = nodes.length

}
return elAll
return this
}

@@ -362,3 +319,2 @@ return memo

function extend(node, key) {

@@ -369,3 +325,2 @@ if (node) for (key in proto) node[key] = proto[key]

// IE 6-7

@@ -407,2 +362,3 @@ if (proto === El[protoStr]) {

//** templates

@@ -463,7 +419,4 @@ function tpl(str) {

var t = this
El.cache(t.name, t.el.removeChild(t.el.firstChild), render)
t.el.plugin = null
return t.parent

@@ -473,19 +426,6 @@ }

tpl.plugins = {
/*
* - Declaration
* mixin list
*
* mixin link(href, name)
* a(class!=attributes.class, href=href)= name
*
* +link('/foo', 'foo')(class="btn")
*
* :include
* :doctype
* - http://stackoverflow.com/questions/8227612/how-to-create-document-objects-with-javascript
*/
"template": template
}
El.tpl = function(str) {
El.create = El.tpl = function(str) {
return tpl(str).render()

@@ -498,4 +438,44 @@ }

}
//*/
//** i18n
function i18n(text, lang) {
return i18n[ lang ? getLang(lang) : currentLang ][text] || text
}
El.i18n = i18n
function getLang(lang) {
if (!lang) return currentLang
lang = (lang || "").toLowerCase()
return i18n[lang] ? lang : ((lang = lang.split("-")[0]), i18n[lang]) ? lang : currentLang
}
function setLang(lang) {
lang = getLang(lang)
if (currentLang != (currentLang = lang)) {
i18n[lang] = i18n[lang] || {}
}
// Use setAttribute
document.documentElement.lang = lang
return lang
}
function addLang(lang, texts) {
Object.merge(i18n[lang] || (i18n[lang] = {}), texts)
}
i18n.get = getLang
i18n.use = setLang
i18n.add = addLang
i18n.def = function(map) {
Object.each(map, function(name, tag) {
addLang(tag, map)
})
}
// setLang("en")
//*/
}(window, document, "prototype")
/*
* @version 0.2.3
* @author Lauri Rooden <lauri@rooden.ee>
* @license MIT License
*/
/**
* @version 0.3.8
* @date 2014-09-19
* @stability 1 - Experimental
* @author Lauri Rooden <lauri@rooden.ee>
* @license MIT License
*/
!function(w) {
var lastSize, lastOrient
var lastSize, lastOrient
, b = document.body
, emit = function(){ w.M && M.emit("resize") }.rate(200, true)
function setClasses() {
var width = b.offsetWidth
function setClasses() {
var width = b.offsetWidth
, next = width < 601 ? "s-mob" : ( width < 1025 ? "s-tab" : "s-full")
if ( next != lastSize ) {
b.addClass( next ).rmClass( lastSize )
if ( next != lastSize ) {
b.addClass( next ).rmClass( lastSize )
lastSize = next
}
}
next = width > b.offsetHeight ? "s-land" : "s-port"
next = width > b.offsetHeight ? "s-land" : "s-port"
if ( next != lastOrient) {
b.addClass( next ).rmClass( lastOrient )
if ( next != lastOrient) {
b.addClass( next ).rmClass( lastOrient )
lastOrient = next
}
}
emit()
}
}
setClasses()

@@ -34,0 +36,0 @@

{
"name": "elements-lite",
"version": "0.3.5",
"version": "0.3.8",
"stability": 1,

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -9,4 +9,4 @@ [1]: https://secure.travis-ci.org/litejs/elements-lite.png

@version 0.3.5
@date 2014-09-15
@version 0.3.8
@date 2014-09-19
@stability 1 - Experimental

@@ -13,0 +13,0 @@

@@ -6,4 +6,4 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

/**
* @version 0.3.4
* @date 2014-09-14
* @version 0.3.6
* @date 2014-09-19
* @stability 1 - Experimental

@@ -21,9 +21,10 @@ * @author Lauri Rooden <lauri@rooden.ee>

!function(window, document, protoStr) {
var elCache = {}
var currentLang
, elCache = {}
, fnCache = {}
, createElement = document.createElement
, proto = (window.HTMLElement || window.Element || El)[protoStr]
, elRe = /([.#:[])([-\w]+)(?:=((["'\/])(?:\\.|.)*?\4|[-\w]+)])?]?/g
, tplRe = /^([ \t]*)(\:?)((?:(["'\/])(?:\\.|.)*?\4|[-\w\:.#\[\]=])+)[ \t]*(.*)$/gm
, renderRe = /[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\.|.)*?\3|[-,\s\w])*))?/g
, elRe = /([.#:[])([-\w]+)(?:=((["'\/])(?:\\?.)*?\4|[-\w]+)])?]?/g
, tplRe = /^([ \t]*)(\:?)((?:(["'\/])(?:\\?.)*?\4|[-\w\:.#\[\]=])+)[ \t]*(.*)$/gm
, renderRe = /[;\s]*(\w+)(?:\s*\:((?:(["'\/])(?:\\?.)*?\3|[-,\s\w])*))?/g
, bindings = El.bindings = {

@@ -99,2 +100,3 @@ "txt": function(node, data, text) {

// -------------------------------
// http://perfectionkills.com/whats-wrong-with-extending-the-dom/
//

@@ -157,4 +159,3 @@ // All DOM extensions on the element are available by default.

// http://jsperf.com/regexp-indexof-perf/32
// return (" "+this.className+" ").indexOf(" "+name+" ") > -1
return RegExp("\\b" + name + "\\b").test(this.className)
return (" " + this.className + " ").indexOf(" " + name + " ") > -1
}

@@ -172,3 +173,3 @@ proto.hasClass = hasClass

var el = this
el.className = (" "+el.className+" ").replace(" "+name+" "," ").trim()
el.className = (" "+el.className+" ").replace(" "+name+" ", " ").trim()
return el

@@ -336,17 +337,17 @@ }

function(sel) {
return new ElAll(this.querySelectorAll(sel))
return new ElWrap(this.querySelectorAll(sel))
} :
function(sel) {
return new ElAll(findEl(this, sel))
return new ElWrap(findEl(this, sel))
}
// TODO:2014-09-13:lauri:Expose ElAll
function ElAll(nodes) {
function ElWrap(nodes) {
this._nodes = nodes
}
El.wrap = ElWrap
ElAll.prototype = Object.keys(proto).reduce(function(memo, key) {
ElWrap.prototype = Object.keys(proto).reduce(function(memo, key) {
memo[key] = function() {
var elAll = this
, nodes = elAll._nodes
var elWrap = this
, nodes = elWrap._nodes
, i = 0

@@ -357,3 +358,3 @@ , len = nodes.length

}
return elAll
return elWrap
}

@@ -486,2 +487,3 @@ return memo

// El.create
El.tpl = function(str) {

@@ -495,91 +497,50 @@ return tpl(str).render()

}
}(window, document, "prototype")
},{}],2:[function(require,module,exports){
/*
* @version 0.2.2
* @date 2014-05-24
* @stability 1 - Experimental
* @author Lauri Rooden <lauri@rooden.ee>
* @license MIT License
*/
/*
* In IE6, most of the choices in the Language Preference list specified a locale-neutral two letter code.
* For instance fr was sent for French (France), and ja sent for Japanese.
* Longer codes were only used when a language is commonly spoken in another country or locale-- for instance fr-CA was available for French-speaking Canadians.
*
* For Internet Explorer 7, a change was made such that Internet Explorer will send the full language/locale pair for each locale.
* IE7 will send fr-FR for French (France) and de-DE for German (Germany).
* This change enables web servers to more easily target content for a specific language and locale.
* If a given server is only interested in the user’s language and not the locale, it can ignore the locale portion by simply truncating the code at the first dash.
*
* Anyway, it's always more user-friendly to use Accept-Language than IP-address-based Geo-Location.
*
* Accept-Language: eo;q=0
* the q stands for "quality" and denotes a preference where 1 is highest and 0 means "not acceptable".
* means "I can't read or understand Esperanto and no, please do not provide any content in that language."
*/
!function(root) {
var current;
function i18n(text, lang) {
return (i18n[lang ? getLang(lang) : current][text] || text)
return i18n[ lang ? getLang(lang) : currentLang ][text] || text
}
El.i18n = i18n
function getLang(lang) {
if (!lang) return current
lang = (lang||"").toLowerCase()
return i18n[lang] ? lang : (lang = lang.split("-")[0]), i18n[lang] ? lang : current
if (!lang) return currentLang
lang = (lang || "").toLowerCase()
return i18n[lang] ? lang : (lang = lang.split("-")[0]), i18n[lang] ? lang : currentLang
}
function setLang(lang) {
lang = i18n.getLang(lang)
if (current != (current = lang)) {
lang = getLang(lang)
if (currentLang != (currentLang = lang)) {
i18n[lang] = i18n[lang] || {}
}
// Use setAttribute
document.documentElement.lang = lang
return lang
}
i18n.getLang = getLang
i18n.setLang = setLang
function addLang(lang, texts) {
Object.merge(i18n[lang] || (i18n[lang] = {}), texts)
}
//i18n.main = i18n.current = "en"
//setLang("en")
i18n.en = {
date: "%a, %d %b %Y %H:%M:%S %z",
name: "Name {date|lang}"
}
i18n.get = getLang
i18n.use = setLang
i18n.add = addLang
i18n.def = function(map) {
Object.each(map, function(name, tag) {
addLang(tag, map)
})
}
i18n.et = {
date: "%Y %H:%M:%S %z",
name: "Nimi {date|lang:'et'}"
}
}(window, document, "prototype")
//i18n.setLang(navigator.language || navigator.userLanguage)
Date.prototype.lang = function(lang) {
return this.format( i18n("date", lang) )
}
String.prototype.lang = function(lang) {
return i18n(this, lang)
}
root.i18n = i18n
}(this)
},{}],2:[function(require,module,exports){
},{}],3:[function(require,module,exports){
/*

@@ -706,3 +667,3 @@ * @version 1.1.0

},{}],4:[function(require,module,exports){
},{}],3:[function(require,module,exports){

@@ -836,2 +797,22 @@

/*
Object.values = function(obj) {
return Object.keys(obj).map(function(e) {
return obj[e]
})
}
Object.values({a:1, b:2, c:3}); //[1, 2, 3]
Array.prototype.flatten = function(){
var arr = this, i = arr.length;
while (i--) if (arr[i] instanceof Array)
arr[i].unshift(i,1) && arr.splice.apply(arr,arr[i].flatten() )
return arr
}
function argsToArray(){
return Array.apply(null, arguments).flatten()
}
argsToArray([[1],3,[4,5]],2)
*/
// Note: use for Object literals only,

@@ -949,3 +930,3 @@ // as it returns false for custom objects,

},{}],5:[function(require,module,exports){
},{}],4:[function(require,module,exports){

@@ -1125,3 +1106,3 @@

},{}],6:[function(require,module,exports){
},{}],5:[function(require,module,exports){
(function (process){

@@ -1402,12 +1383,12 @@

}).call(this,require("/usr/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))
},{"/usr/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":8}],7:[function(require,module,exports){
},{"/usr/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":7}],6:[function(require,module,exports){
(function (global){
require("browser-upgrade-lite")
global.Fn = require("functional-lite").Fn
global.Event = global.Event || {}
global.i18n = require("../lib/i18n.js").i18n
global.Fn = require("functional-lite").Fn
require("liquid-filters-lite")
require("../")
global.i18n = window.El.i18n

@@ -1423,4 +1404,42 @@ function getString(node) {

i18n.setLang("en")
i18n.def({ "et":"Eesti keeles"
, "en":"In English"
, "ru":"На русском"
, "fi":"Suomeksi"
, "se":"på Svenska"
})
i18n.add("en", {
date: "%a, %d %b %Y %H:%M:%S %z",
name: "Name {date|lang}"
})
i18n.add("et", {
date: "%Y %H:%M:%S %z",
name: "Nimi {date|lang:'et'}"
})
/*
* navigator.language
* "et"
* navigator.languages
* ["et", "en-US", "en"]
*/
//i18n.setLang(navigator.language || navigator.userLanguage)
Date.prototype.lang = function(lang) {
return this.format( i18n("date", lang) )
}
String.prototype.lang = function(lang) {
return i18n(this, lang)
}
i18n.add("en", {
firstName: "First Name",
lastName: "Last Name"
})
i18n.use("en")
var el, h1, h2, h3, h4, input, select, t1

@@ -1657,2 +1676,3 @@

, "<a><b class=\"\" data-bind=\"class:'red','i>1'\"><i data-bind=\"txt:'hello {name}'\">hello world</i></b></a>"
, "<a><b data-bind=\"class:'red','i>1'\" class=\"\"><i data-bind=\"txt:'hello {name}'\">hello world</i></b></a>"
]).

@@ -1752,3 +1772,3 @@ anyOf(getString(t1.render({i:2,name:"moon"})),

}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../":1,"../lib/i18n.js":2,"browser-upgrade-lite":3,"functional-lite":4,"liquid-filters-lite":5,"testman":6}],8:[function(require,module,exports){
},{"../":1,"browser-upgrade-lite":2,"functional-lite":3,"liquid-filters-lite":4,"testman":5}],7:[function(require,module,exports){
// shim for using process in browser

@@ -1808,2 +1828,2 @@

},{}]},{},[7])
},{}]},{},[6])
require("browser-upgrade-lite")
global.Fn = require("functional-lite").Fn
global.Event = global.Event || {}
global.i18n = require("../lib/i18n.js").i18n
global.Fn = require("functional-lite").Fn
require("liquid-filters-lite")
require("../")
global.i18n = window.El.i18n

@@ -19,4 +19,42 @@ function getString(node) {

i18n.setLang("en")
i18n.def({ "et":"Eesti keeles"
, "en":"In English"
, "ru":"На русском"
, "fi":"Suomeksi"
, "se":"på Svenska"
})
i18n.add("en", {
date: "%a, %d %b %Y %H:%M:%S %z",
name: "Name {date|lang}"
})
i18n.add("et", {
date: "%Y %H:%M:%S %z",
name: "Nimi {date|lang:'et'}"
})
/*
* navigator.language
* "et"
* navigator.languages
* ["et", "en-US", "en"]
*/
//i18n.setLang(navigator.language || navigator.userLanguage)
Date.prototype.lang = function(lang) {
return this.format( i18n("date", lang) )
}
String.prototype.lang = function(lang) {
return i18n(this, lang)
}
i18n.add("en", {
firstName: "First Name",
lastName: "Last Name"
})
i18n.use("en")
var el, h1, h2, h3, h4, input, select, t1

@@ -253,2 +291,3 @@

, "<a><b class=\"\" data-bind=\"class:'red','i>1'\"><i data-bind=\"txt:'hello {name}'\">hello world</i></b></a>"
, "<a><b data-bind=\"class:'red','i>1'\" class=\"\"><i data-bind=\"txt:'hello {name}'\">hello world</i></b></a>"
]).

@@ -255,0 +294,0 @@ anyOf(getString(t1.render({i:2,name:"moon"})),

var dom = require("dom-lite")
dom.document.querySelector = dom.document.querySelectorAll = null
dom.document.documentElement = {}

@@ -4,0 +5,0 @@ global.document = dom.document

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