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

cash-dom

Package Overview
Dependencies
Maintainers
3
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cash-dom - npm Package Compare versions

Comparing version 3.0.0-beta.0 to 3.0.0-beta.1

docs/migration_guide.md

53

dist/cash.d.ts
interface Cash {
[index: number]: Window & Document & HTMLElement & Element;
[index: number]: Window & Document & HTMLElement & Element & Node;
length: number;

@@ -14,3 +14,3 @@ splice(start: number, deleteCount?: number): any;

declare type falsy = undefined | null | false | 0 | '';
declare type Ele = Window | Document | HTMLElement | Element;
declare type Ele = Window | Document | HTMLElement | Element | Node;
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<any> | Cash;

@@ -83,3 +83,3 @@ declare type Comparator = string | Function | Ele | Cash;

}
declare function pluck(arr: ArrayLike<any>, prop: string): ArrayLike<any>;
declare function pluck(arr: ArrayLike<any>, prop: string, deep?: boolean): ArrayLike<any>;
declare function isCash(x: any): x is Cash;

@@ -105,2 +105,3 @@ declare function isFunction(x: any): x is Function;

}
declare function filtered(collection: Cash, comparator?: Comparator): Cash;
declare const splitValuesRe: RegExp;

@@ -204,2 +205,14 @@ declare function getSplitValues(str: string): RegExpMatchArray;

}
declare const defaultDisplay: {};
declare function getDefaultDisplay(tagName: string): string;
declare function isHidden(ele: HTMLElement): boolean;
interface Cash {
toggle(force?: boolean): this;
}
interface Cash {
hide(): this;
}
interface Cash {
show(): this;
}
declare function hasNamespaces(ns1: string[], ns2: string[]): boolean;

@@ -248,3 +261,3 @@ declare const eventsNamespace = "__cashEvents", eventsNamespacesSeparator = ".";

declare function val(this: Cash): string | string[];
declare function val(this: Cash, value: string): Cash;
declare function val(this: Cash, value: string | string[]): Cash;
interface Cash {

@@ -315,2 +328,14 @@ clone(): this;

declare function text(this: Cash, text: string): Cash;
interface Cash {
unwrap(): this;
}
interface Cash {
wrapAll(selector?: Selector): this;
}
interface Cash {
wrap(selector?: Selector): this;
}
interface Cash {
wrapInner(selector?: Selector): this;
}
declare const docEle: HTMLElement;

@@ -333,3 +358,3 @@ interface Cash {

interface Cash {
children(selector?: string): Cash;
children(comparator?: Comparator): Cash;
}

@@ -349,9 +374,12 @@ interface Cash {

interface Cash {
next(): Cash;
next(comparator?: Comparator, all?: boolean): Cash;
}
interface Cash {
nextAll(comparator?: Comparator): Cash;
}
interface Cash {
not(comparator: Comparator): Cash;
}
interface Cash {
parent(): Cash;
parent(comparator?: Comparator): Cash;
}

@@ -362,13 +390,16 @@ interface Cash {

interface Cash {
closest(selector: string): Cash;
closest(comparator: Comparator): Cash;
}
interface Cash {
parents(selector?: string): Cash;
parents(comparator?: Comparator): Cash;
}
interface Cash {
prev(): Cash;
prev(comparator?: Comparator, all?: boolean): Cash;
}
interface Cash {
siblings(): Cash;
prevAll(comparator?: Comparator): Cash;
}
interface Cash {
siblings(comparator?: Comparator): Cash;
}
//# sourceMappingURL=cash.d.ts.map

@@ -162,3 +162,4 @@ /* MIT https://github.com/kenwheeler/cash */

function matches(ele, selector) {
return !!ele && !!ele.matches && ele.matches(selector);
var matches = ele && (ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector']);
return !!matches && matches.call(ele, selector);
}

@@ -168,8 +169,16 @@

function pluck(arr, prop) {
return filter.call(map.call(arr, function (ele) {
return ele[prop];
}), function (ele) {
return ele != null;
});
function pluck(arr, prop, deep) {
var plucked = [];
for (var i = 0, l = arr.length; i < l; i++) {
var val_1 = arr[i][prop];
while (val_1 != null) {
plucked.push(val_1);
if (!deep) break;
val_1 = val_1[prop];
}
}
return plucked;
} // @require ./cash.ts

@@ -235,5 +244,10 @@

}));
}; // @require ./type_checking.ts
}; // @require collection/filter.ts
function filtered(collection, comparator) {
return !comparator || !collection.length ? collection : collection.filter(comparator);
} // @require ./type_checking.ts
var splitValuesRe = /\S+/g;

@@ -246,3 +260,3 @@

Cash.prototype.hasClass = function (cls) {
return some.call(this, function (ele) {
return cls && some.call(this, function (ele) {
return ele.classList.contains(cls);

@@ -564,3 +578,47 @@ });

// @optional ./outer.ts
// @require css/helpers/compute_style.ts
var defaultDisplay = {};
function getDefaultDisplay(tagName) {
if (defaultDisplay[tagName]) return defaultDisplay[tagName];
var ele = doc.createElement(tagName);
doc.body.appendChild(ele);
var display = computeStyle(ele, 'display');
doc.body.removeChild(ele);
return defaultDisplay[tagName] = display !== 'none' ? display : 'block';
} // @require css/helpers/compute_style.ts
function isHidden(ele) {
return computeStyle(ele, 'display') === 'none';
}
Cash.prototype.toggle = function (force) {
return this.each(function (i, ele) {
force = force !== undefined ? force : isHidden(ele);
if (force) {
ele.style.display = '';
if (isHidden(ele)) {
ele.style.display = getDefaultDisplay(ele.tagName);
}
} else {
ele.style.display = 'none';
}
});
};
Cash.prototype.hide = function () {
return this.toggle(false);
};
Cash.prototype.show = function () {
return this.toggle(true);
}; // @optional ./hide.ts
// @optional ./show.ts
// @optional ./toggle.ts
function hasNamespaces(ns1, ns2) {

@@ -787,11 +845,9 @@ return !ns2 || !some.call(ns2, function (ns) {

return this.each(function (i, ele) {
var isMultiple = ele.multiple,
eleValue = value === null ? isMultiple ? [] : '' : value;
if (isMultiple && isArray(eleValue)) {
if (ele.tagName === 'SELECT') {
var eleValue_1 = isArray(value) ? value : value === null ? [] : [value];
each(ele.options, function (i, option) {
option.selected = eleValue.indexOf(option.value) >= 0;
option.selected = eleValue_1.indexOf(option.value) >= 0;
});
} else {
ele.value = eleValue;
ele.value = value === null ? '' : value;
}

@@ -990,3 +1046,42 @@ });

;
Cash.prototype.text = text; // @optional ./after.ts
Cash.prototype.text = text;
Cash.prototype.unwrap = function () {
this.parent().each(function (i, ele) {
var $ele = cash(ele);
$ele.replaceWith($ele.children());
});
return this;
};
Cash.prototype.wrapAll = function (selector) {
if (this[0]) {
var structure = cash(selector);
this.first().before(structure);
var wrapper = structure[0];
while (wrapper.children.length) {
wrapper = wrapper.firstElementChild;
}
this.appendTo(wrapper);
}
return this;
};
Cash.prototype.wrap = function (selector) {
return this.each(function (index, ele) {
var wrapper = cash(selector)[0];
cash(ele).wrapAll(!index ? wrapper : wrapper.cloneNode(true));
});
};
Cash.prototype.wrapInner = function (selector) {
return this.each(function (i, ele) {
var $ele = cash(ele),
contents = $ele.contents();
contents.length ? contents.wrapAll(selector) : $ele.append(selector);
});
}; // @optional ./after.ts
// @optional ./append.ts

@@ -1007,5 +1102,10 @@ // @optional ./append_to.ts

// @optional ./text.ts
// @optional ./unwrap.ts
// @optional ./wrap.ts
// @optional ./wrap_all.ts
// @optional ./wrap_inner.ts
// @require core/cash.ts
// @require core/variables.ts
var docEle = doc.documentElement;

@@ -1036,3 +1136,3 @@

Cash.prototype.children = function (selector) {
Cash.prototype.children = function (comparator) {
var result = [];

@@ -1042,5 +1142,3 @@ this.each(function (i, ele) {

});
result = cash(unique(result));
if (!selector) return result;
return result.filter(selector);
return filtered(cash(unique(result)), comparator);
};

@@ -1090,6 +1188,10 @@

Cash.prototype.next = function () {
return cash(unique(pluck(this, 'nextElementSibling')));
Cash.prototype.next = function (comparator, all) {
return filtered(cash(unique(pluck(this, 'nextElementSibling', all))), comparator);
};
Cash.prototype.nextAll = function (comparator) {
return this.next(comparator, true);
};
Cash.prototype.not = function (comparator) {

@@ -1103,4 +1205,4 @@ if (!comparator || !this[0]) return this;

Cash.prototype.parent = function () {
return cash(unique(pluck(this, 'parentNode')));
Cash.prototype.parent = function (comparator) {
return filtered(cash(unique(pluck(this, 'parentNode'))), comparator);
};

@@ -1114,34 +1216,26 @@

Cash.prototype.closest = function (selector) {
if (!selector || !this[0]) return cash();
if (this.is(selector)) return this.filter(selector);
return this.parent().closest(selector);
Cash.prototype.closest = function (comparator) {
if (!comparator || !this[0]) return cash();
var filtered = this.filter(comparator);
if (filtered.length) return filtered;
return this.parent().closest(comparator);
};
Cash.prototype.parents = function (selector) {
var result = [];
var last;
this.each(function (i, ele) {
last = ele;
Cash.prototype.parents = function (comparator) {
return filtered(cash(unique(pluck(this, 'parentElement', true))), comparator);
};
while (last && last.parentNode && last !== doc.body.parentNode) {
last = last.parentNode;
if (!selector || selector && matches(last, selector)) {
result.push(last);
}
}
});
return cash(unique(result));
Cash.prototype.prev = function (comparator, all) {
return filtered(cash(unique(pluck(this, 'previousElementSibling', all))), comparator);
};
Cash.prototype.prev = function () {
return cash(unique(pluck(this, 'previousElementSibling')));
Cash.prototype.prevAll = function (comparator) {
return this.prev(comparator, true);
};
Cash.prototype.siblings = function () {
Cash.prototype.siblings = function (comparator) {
var ele = this[0];
return this.parent().children().filter(function (i, child) {
return filtered(this.parent().children().filter(function (i, child) {
return child !== ele;
});
}), comparator);
}; // @optional ./children.ts

@@ -1164,2 +1258,3 @@ // @optional ./closest.ts

// @optional dimensions/index.ts
// @optional effects/index.ts
// @optional events/index.ts

@@ -1166,0 +1261,0 @@ // @optional forms/index.ts

@@ -162,3 +162,4 @@ /* MIT https://github.com/kenwheeler/cash */

function matches(ele, selector) {
return !!ele && !!ele.matches && ele.matches(selector);
var matches = ele && (ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector']);
return !!matches && matches.call(ele, selector);
}

@@ -168,8 +169,16 @@

function pluck(arr, prop) {
return filter.call(map.call(arr, function (ele) {
return ele[prop];
}), function (ele) {
return ele != null;
});
function pluck(arr, prop, deep) {
var plucked = [];
for (var i = 0, l = arr.length; i < l; i++) {
var val_1 = arr[i][prop];
while (val_1 != null) {
plucked.push(val_1);
if (!deep) break;
val_1 = val_1[prop];
}
}
return plucked;
} // @require ./cash.ts

@@ -235,5 +244,10 @@

}));
}; // @require ./type_checking.ts
}; // @require collection/filter.ts
function filtered(collection, comparator) {
return !comparator || !collection.length ? collection : collection.filter(comparator);
} // @require ./type_checking.ts
var splitValuesRe = /\S+/g;

@@ -246,3 +260,3 @@

Cash.prototype.hasClass = function (cls) {
return some.call(this, function (ele) {
return cls && some.call(this, function (ele) {
return ele.classList.contains(cls);

@@ -564,3 +578,47 @@ });

// @optional ./outer.ts
// @require css/helpers/compute_style.ts
var defaultDisplay = {};
function getDefaultDisplay(tagName) {
if (defaultDisplay[tagName]) return defaultDisplay[tagName];
var ele = doc.createElement(tagName);
doc.body.appendChild(ele);
var display = computeStyle(ele, 'display');
doc.body.removeChild(ele);
return defaultDisplay[tagName] = display !== 'none' ? display : 'block';
} // @require css/helpers/compute_style.ts
function isHidden(ele) {
return computeStyle(ele, 'display') === 'none';
}
Cash.prototype.toggle = function (force) {
return this.each(function (i, ele) {
force = force !== undefined ? force : isHidden(ele);
if (force) {
ele.style.display = '';
if (isHidden(ele)) {
ele.style.display = getDefaultDisplay(ele.tagName);
}
} else {
ele.style.display = 'none';
}
});
};
Cash.prototype.hide = function () {
return this.toggle(false);
};
Cash.prototype.show = function () {
return this.toggle(true);
}; // @optional ./hide.ts
// @optional ./show.ts
// @optional ./toggle.ts
function hasNamespaces(ns1, ns2) {

@@ -787,11 +845,9 @@ return !ns2 || !some.call(ns2, function (ns) {

return this.each(function (i, ele) {
var isMultiple = ele.multiple,
eleValue = value === null ? isMultiple ? [] : '' : value;
if (isMultiple && isArray(eleValue)) {
if (ele.tagName === 'SELECT') {
var eleValue_1 = isArray(value) ? value : value === null ? [] : [value];
each(ele.options, function (i, option) {
option.selected = eleValue.indexOf(option.value) >= 0;
option.selected = eleValue_1.indexOf(option.value) >= 0;
});
} else {
ele.value = eleValue;
ele.value = value === null ? '' : value;
}

@@ -990,3 +1046,42 @@ });

;
Cash.prototype.text = text; // @optional ./after.ts
Cash.prototype.text = text;
Cash.prototype.unwrap = function () {
this.parent().each(function (i, ele) {
var $ele = cash(ele);
$ele.replaceWith($ele.children());
});
return this;
};
Cash.prototype.wrapAll = function (selector) {
if (this[0]) {
var structure = cash(selector);
this.first().before(structure);
var wrapper = structure[0];
while (wrapper.children.length) {
wrapper = wrapper.firstElementChild;
}
this.appendTo(wrapper);
}
return this;
};
Cash.prototype.wrap = function (selector) {
return this.each(function (index, ele) {
var wrapper = cash(selector)[0];
cash(ele).wrapAll(!index ? wrapper : wrapper.cloneNode(true));
});
};
Cash.prototype.wrapInner = function (selector) {
return this.each(function (i, ele) {
var $ele = cash(ele),
contents = $ele.contents();
contents.length ? contents.wrapAll(selector) : $ele.append(selector);
});
}; // @optional ./after.ts
// @optional ./append.ts

@@ -1007,5 +1102,10 @@ // @optional ./append_to.ts

// @optional ./text.ts
// @optional ./unwrap.ts
// @optional ./wrap.ts
// @optional ./wrap_all.ts
// @optional ./wrap_inner.ts
// @require core/cash.ts
// @require core/variables.ts
var docEle = doc.documentElement;

@@ -1036,3 +1136,3 @@

Cash.prototype.children = function (selector) {
Cash.prototype.children = function (comparator) {
var result = [];

@@ -1042,5 +1142,3 @@ this.each(function (i, ele) {

});
result = cash(unique(result));
if (!selector) return result;
return result.filter(selector);
return filtered(cash(unique(result)), comparator);
};

@@ -1090,6 +1188,10 @@

Cash.prototype.next = function () {
return cash(unique(pluck(this, 'nextElementSibling')));
Cash.prototype.next = function (comparator, all) {
return filtered(cash(unique(pluck(this, 'nextElementSibling', all))), comparator);
};
Cash.prototype.nextAll = function (comparator) {
return this.next(comparator, true);
};
Cash.prototype.not = function (comparator) {

@@ -1103,4 +1205,4 @@ if (!comparator || !this[0]) return this;

Cash.prototype.parent = function () {
return cash(unique(pluck(this, 'parentNode')));
Cash.prototype.parent = function (comparator) {
return filtered(cash(unique(pluck(this, 'parentNode'))), comparator);
};

@@ -1114,34 +1216,26 @@

Cash.prototype.closest = function (selector) {
if (!selector || !this[0]) return cash();
if (this.is(selector)) return this.filter(selector);
return this.parent().closest(selector);
Cash.prototype.closest = function (comparator) {
if (!comparator || !this[0]) return cash();
var filtered = this.filter(comparator);
if (filtered.length) return filtered;
return this.parent().closest(comparator);
};
Cash.prototype.parents = function (selector) {
var result = [];
var last;
this.each(function (i, ele) {
last = ele;
Cash.prototype.parents = function (comparator) {
return filtered(cash(unique(pluck(this, 'parentElement', true))), comparator);
};
while (last && last.parentNode && last !== doc.body.parentNode) {
last = last.parentNode;
if (!selector || selector && matches(last, selector)) {
result.push(last);
}
}
});
return cash(unique(result));
Cash.prototype.prev = function (comparator, all) {
return filtered(cash(unique(pluck(this, 'previousElementSibling', all))), comparator);
};
Cash.prototype.prev = function () {
return cash(unique(pluck(this, 'previousElementSibling')));
Cash.prototype.prevAll = function (comparator) {
return this.prev(comparator, true);
};
Cash.prototype.siblings = function () {
Cash.prototype.siblings = function (comparator) {
var ele = this[0];
return this.parent().children().filter(function (i, child) {
return filtered(this.parent().children().filter(function (i, child) {
return child !== ele;
});
}), comparator);
}; // @optional ./children.ts

@@ -1164,2 +1258,3 @@ // @optional ./closest.ts

// @optional dimensions/index.ts
// @optional effects/index.ts
// @optional events/index.ts

@@ -1166,0 +1261,0 @@ // @optional forms/index.ts

/* MIT https://github.com/kenwheeler/cash */
(function(){
'use strict';var e=document,f=window,k=e.createElement("div"),l=Array.prototype,m=l.filter,n=l.indexOf,p=l.map,q=l.push,r=l.reverse,t=l.slice,u=l.some,aa=l.splice,ba=/^#[\w-]*$/,ca=/^\.[\w-]*$/,da=/<.+>/,ea=/^\w+$/;function v(a,b){void 0===b&&(b=e);return ca.test(a)?b.getElementsByClassName(a.slice(1)):ea.test(a)?b.getElementsByTagName(a):b.querySelectorAll(a)}
var w=function(){function a(a,c){void 0===c&&(c=e);if(a){if(a instanceof w)return a;var b=a;if(x(a)){if(b=c instanceof w?c[0]:c,b=ba.test(a)?b.getElementById(a.slice(1)):da.test(a)?y(a):v(a,b),!b)return}else if(A(a))return this.ready(a);if(b.nodeType||b===f)b=[b];this.length=b.length;a=0;for(c=this.length;a<c;a++)this[a]=b[a]}}a.prototype.init=function(b,c){return new a(b,c)};return a}(),B=w.prototype.init;B.fn=B.prototype=w.prototype;w.prototype.length=0;w.prototype.splice=aa;
w.prototype.get=function(a){return void 0===a?t.call(this):this[0>a?a+this.length:a]};w.prototype.eq=function(a){return B(this.get(a))};w.prototype.first=function(){return this.eq(0)};w.prototype.last=function(){return this.eq(-1)};w.prototype.map=function(a){return B(p.call(this,function(b,c){return a.call(b,c,b)}))};w.prototype.slice=function(){return B(t.apply(this,arguments))};var fa=/-([a-z])/g;function ha(a,b){return b.toUpperCase()}function C(a){return a.replace(fa,ha)}B.camelCase=C;
function D(a,b){for(var c=0,d=a.length;c<d&&!1!==b.call(a[c],c,a[c]);c++);}B.each=D;w.prototype.each=function(a){D(this,a);return this};w.prototype.removeProp=function(a){return this.each(function(b,c){delete c[a]})};function E(a){for(var b=1;b<arguments.length;b++);b=arguments;for(var c=b.length,d=2>c?0:1;d<c;d++)for(var g in b[d])a[g]=b[d][g];return a}w.prototype.extend=function(a){return E(B.fn,a)};B.extend=E;var F=1;B.guid=F;function G(a,b){return!!a&&!!a.matches&&a.matches(b)}B.matches=G;
function H(a,b){return m.call(p.call(a,function(a){return a[b]}),function(a){return null!=a})}function A(a){return"function"===typeof a}function x(a){return"string"===typeof a}function I(a){return!isNaN(parseFloat(a))&&isFinite(a)}var J=Array.isArray;B.isFunction=A;B.isString=x;B.isNumeric=I;B.isArray=J;w.prototype.prop=function(a,b){if(a){if(x(a))return 2>arguments.length?this[0]&&this[0][a]:this.each(function(c,g){g[a]=b});for(var c in a)this.prop(c,a[c]);return this}};
function K(a){return x(a)?function(b,c){return G(c,a)}:A(a)?a:a instanceof w?function(b,c){return a.is(c)}:function(b,c){return c===a}}w.prototype.filter=function(a){if(!a)return B();var b=K(a);return B(m.call(this,function(a,d){return b.call(a,d,a)}))};var ia=/\S+/g;function L(a){return x(a)?a.match(ia)||[]:[]}w.prototype.hasClass=function(a){return u.call(this,function(b){return b.classList.contains(a)})};
w.prototype.removeAttr=function(a){var b=L(a);return b.length?this.each(function(a,d){D(b,function(a,b){d.removeAttribute(b)})}):this};w.prototype.attr=function(a,b){if(a){if(x(a)){if(2>arguments.length){if(!this[0])return;var c=this[0].getAttribute(a);return null===c?void 0:c}return null===b?this.removeAttr(a):this.each(function(c,g){g.setAttribute(a,b)})}for(c in a)this.attr(c,a[c]);return this}};
w.prototype.toggleClass=function(a,b){var c=L(a),d=void 0!==b;return c.length?this.each(function(a,h){D(c,function(a,c){d?b?h.classList.add(c):h.classList.remove(c):h.classList.toggle(c)})}):this};w.prototype.addClass=function(a){return this.toggleClass(a,!0)};w.prototype.removeClass=function(a){return arguments.length?this.toggleClass(a,!1):this.attr("class","")};function M(a){return 1<a.length?m.call(a,function(a,c,d){return n.call(d,a)===c}):a}B.unique=M;
w.prototype.add=function(a,b){return B(M(this.get().concat(B(a,b).get())))};function N(a,b,c){if(1===a.nodeType&&b)return a=f.getComputedStyle(a,null),b?c?a.getPropertyValue(b)||void 0:a[b]:a}function P(a,b){return parseInt(N(a,b),10)||0}var Q=/^--/,R={},ja=k.style,ka=["webkit","moz","ms","o"];
function S(a,b){void 0===b&&(b=Q.test(a));if(b)return a;if(!R[a]){b=C(a);var c=""+b.charAt(0).toUpperCase()+b.slice(1);b=(b+" "+ka.join(c+" ")+c).split(" ");D(b,function(b,c){if(c in ja)return R[a]=c,!1})}return R[a]}B.prefixedProp=S;var la={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function T(a,b,c){void 0===c&&(c=Q.test(a));return c||la[a]||!I(b)?b:b+"px"}
w.prototype.css=function(a,b){if(x(a)){var c=Q.test(a);a=S(a,c);if(2>arguments.length)return this[0]&&N(this[0],a,c);if(!a)return this;b=T(a,b,c);return this.each(function(d,h){1===h.nodeType&&(c?h.style.setProperty(a,b):h.style[a]=b)})}for(var d in a)this.css(d,a[d]);return this};var ma=/^data-(.*)/;B.hasData=function(a){return"__cashData"in a};function U(a){return a.__cashData=a.__cashData||{}}
function V(a,b){var c=U(a);if(b){if(!(b in c)&&(a=a.dataset?a.dataset[b]||a.dataset[C(b)]:B(a).attr("data-"+b),void 0!==a)){try{a=JSON.parse(a)}catch(d){}c[b]=a}return c[b]}return c}w.prototype.data=function(a,b){var c=this;if(!a){if(!this[0])return;D(this[0].attributes,function(a,b){(a=b.name.match(ma))&&c.data(a[1])});return V(this[0])}if(x(a))return void 0===b?this[0]&&V(this[0],a):this.each(function(c,d){U(d)[a]=b});for(var d in a)this.data(d,a[d]);return this};
w.prototype.removeData=function(a){return this.each(function(b,c){void 0===a?delete c.__cashData:delete U(c)[a]})};function na(a,b){return P(a,"border"+(b?"Left":"Top")+"Width")+P(a,"padding"+(b?"Left":"Top"))+P(a,"padding"+(b?"Right":"Bottom"))+P(a,"border"+(b?"Right":"Bottom")+"Width")}D(["Width","Height"],function(a,b){w.prototype["inner"+b]=function(){if(this[0])return this[0]===f?f["inner"+b]:this[0]["client"+b]}});
D(["width","height"],function(a,b){w.prototype[b]=function(c){if(!this[0])return void 0===c?void 0:this;if(!arguments.length)return this[0]===f?this[0][C("outer-"+b)]:this[0].getBoundingClientRect()[b]-na(this[0],!a);var d=parseInt(c,10);return this.each(function(c,h){1===h.nodeType&&(c=N(h,"boxSizing"),h.style[b]=T(b,d+("border-box"===c?na(h,!a):0)))})}});
D(["Width","Height"],function(a,b){w.prototype["outer"+b]=function(c){if(this[0])return this[0]===f?f["outer"+b]:this[0]["offset"+b]+(c?P(this[0],"margin"+(a?"Top":"Left"))+P(this[0],"margin"+(a?"Bottom":"Right")):0)}});function oa(a,b){return!b||!u.call(b,function(b){return 0>a.indexOf(b)})}function pa(a,b,c,d){d.guid=d.guid||F++;var g=a.__cashEvents=a.__cashEvents||{};g[b]=g[b]||[];g[b].push([c,d]);a.addEventListener(b,d)}function W(a){a=a.split(".");return[a[0],a.slice(1).sort()]}
function X(a,b,c,d){var g=a.__cashEvents=a.__cashEvents||{};if(b)g[b]&&(g[b]=g[b].filter(function(g){var h=g[0];g=g[1];if(d&&g.guid!==d.guid||!oa(h,c))return!0;a.removeEventListener(b,g)}));else{for(b in g)X(a,b,c,d);delete a.__cashEvents}}w.prototype.off=function(a,b){var c=this;void 0===a?this.each(function(a,b){return X(b)}):D(L(a),function(a,g){a=W(g);var d=a[0],z=a[1];c.each(function(a,c){return X(c,d,z,b)})});return this};
w.prototype.on=function(a,b,c,d){var g=this;if(!x(a)){for(var h in a)this.on(h,b,a[h]);return this}A(b)&&(c=b,b="");D(L(a),function(a,h){a=W(h);var z=a[0],O=a[1];g.each(function(a,g){a=function sa(a){if(!a.namespace||oa(O,a.namespace.split("."))){var h=g;if(b)for(h=a.target;!G(h,b);){if(h===g)return;h=h.parentNode;if(!h)return}a.namespace=a.namespace||"";h=c.call(h,a,a.data);d&&X(g,z,O,sa);!1===h&&(a.preventDefault(),a.stopPropagation())}};a.guid=c.guid=c.guid||F++;pa(g,z,O,a)})});return this};
w.prototype.one=function(a,b,c){return this.on(a,b,c,!0)};w.prototype.ready=function(a){function b(){return a(B)}"loading"!==e.readyState?setTimeout(b):e.addEventListener("DOMContentLoaded",b);return this};w.prototype.trigger=function(a,b){var c=a;if(x(a)){var d=W(a);a=d[0];d=d[1];c=e.createEvent("HTMLEvents");c.initEvent(a,!0,!0);c.namespace=d.join(".")}c.data=b;return this.each(function(a,b){b.dispatchEvent(c)})};
function qa(a){return a.multiple?H(m.call(a.options,function(a){return a.selected&&!a.disabled&&!a.parentNode.disabled}),"value"):a.value||""}var ra=/%20/g,ta=/file|reset|submit|button|image/i,ua=/radio|checkbox/i;
w.prototype.serialize=function(){var a="";this.each(function(b,c){D(c.elements||[c],function(b,c){c.disabled||!c.name||"FIELDSET"===c.tagName||ta.test(c.type)||ua.test(c.type)&&!c.checked||(b=qa(c),void 0!==b&&(b=J(b)?b:[b],D(b,function(b,d){b=a;d="&"+encodeURIComponent(c.name)+"="+encodeURIComponent(d).replace(ra,"+");a=b+d})))})});return a.substr(1)};
w.prototype.val=function(a){return void 0===a?this[0]&&qa(this[0]):this.each(function(b,c){b=c.multiple;var d=null===a?b?[]:"":a;b&&J(d)?D(c.options,function(a,b){b.selected=0<=d.indexOf(b.value)}):c.value=d})};w.prototype.clone=function(){return this.map(function(a,b){return b.cloneNode(!0)})};w.prototype.detach=function(){return this.each(function(a,b){b.parentNode&&b.parentNode.removeChild(b)})};var va=/^\s*<(\w+)[^>]*>/,wa=/^\s*<(\w+)\s*\/?>(?:<\/\1>)?\s*$/,Y;
function y(a){if(!Y){var b=e.createElement("table"),c=e.createElement("tr");Y={"*":k,tr:e.createElement("tbody"),td:c,th:c,thead:b,tbody:b,tfoot:b}}if(!x(a))return[];if(wa.test(a))return[e.createElement(RegExp.$1)];b=va.test(a)&&RegExp.$1;b=Y[b]||Y["*"];b.innerHTML=a;return B(b.childNodes).detach().get()}B.parseHTML=y;w.prototype.empty=function(){var a=this[0];if(a)for(;a.firstChild;)a.removeChild(a.firstChild);return this};
function Z(a,b,c){D(a,function(a,g){D(b,function(b,d){b=a?d.cloneNode(!0):d;c?g.insertBefore(b,g.childNodes[0]):g.appendChild(b)})})}w.prototype.append=function(){var a=this;D(arguments,function(b,c){Z(a,B(c))});return this};w.prototype.appendTo=function(a){Z(B(a),this);return this};w.prototype.html=function(a){return void 0===a?this[0]&&this[0].innerHTML:this.each(function(b,c){c.innerHTML=a})};
w.prototype.insertAfter=function(a){var b=this;B(a).each(function(a,d){var c=d.parentNode;c&&b.each(function(b,g){c.insertBefore(a?g.cloneNode(!0):g,d.nextSibling)})});return this};w.prototype.after=function(){var a=this;D(r.apply(arguments),function(b,c){r.apply(B(c).slice()).insertAfter(a)});return this};w.prototype.insertBefore=function(a){var b=this;B(a).each(function(a,d){var c=d.parentNode;c&&b.each(function(b,g){c.insertBefore(a?g.cloneNode(!0):g,d)})});return this};
w.prototype.before=function(){var a=this;D(arguments,function(b,c){B(c).insertBefore(a)});return this};w.prototype.prepend=function(){var a=this;D(arguments,function(b,c){Z(a,B(c),!0)});return this};w.prototype.prependTo=function(a){Z(B(a),r.apply(this.slice()),!0);return this};w.prototype.remove=function(){return this.detach().off()};w.prototype.replaceWith=function(a){return this.before(a).remove()};w.prototype.replaceAll=function(a){B(a).replaceWith(this);return this};
w.prototype.text=function(a){return void 0===a?this[0]?this[0].textContent:"":this.each(function(b,c){c.textContent=a})};var xa=e.documentElement;w.prototype.offset=function(){var a=this[0];if(a)return a=a.getBoundingClientRect(),{top:a.top+f.pageYOffset-xa.clientTop,left:a.left+f.pageXOffset-xa.clientLeft}};w.prototype.offsetParent=function(){return B(this[0]&&this[0].offsetParent)};w.prototype.position=function(){var a=this[0];if(a)return{left:a.offsetLeft,top:a.offsetTop}};
w.prototype.children=function(a){var b=[];this.each(function(a,d){q.apply(b,d.children)});b=B(M(b));return a?b.filter(a):b};w.prototype.contents=function(){var a=[];this.each(function(b,c){q.apply(a,"IFRAME"===c.tagName?[c.contentDocument]:c.childNodes)});return B(M(a))};w.prototype.find=function(a){for(var b=[],c=0,d=this.length;c<d;c++){var g=v(a,this[c]);g.length&&q.apply(b,g)}return B(M(b))};
w.prototype.has=function(a){var b=x(a)?function(b,d){return!!v(a,d).length}:function(b,d){return d.contains(a)};return this.filter(b)};w.prototype.is=function(a){if(!a||!this[0])return!1;var b=K(a),c=!1;this.each(function(a,g){c=b.call(g,a,g);return!c});return c};w.prototype.next=function(){return B(M(H(this,"nextElementSibling")))};w.prototype.not=function(a){if(!a||!this[0])return this;var b=K(a);return this.filter(function(a,d){return!b.call(d,a,d)})};
w.prototype.parent=function(){return B(M(H(this,"parentNode")))};w.prototype.index=function(a){var b=a?B(a)[0]:this[0];a=a?this:B(b).parent().children();return n.call(a,b)};w.prototype.closest=function(a){return a&&this[0]?this.is(a)?this.filter(a):this.parent().closest(a):B()};w.prototype.parents=function(a){var b=[],c;this.each(function(d,g){for(c=g;c&&c.parentNode&&c!==e.body.parentNode;)c=c.parentNode,(!a||a&&G(c,a))&&b.push(c)});return B(M(b))};w.prototype.prev=function(){return B(M(H(this,"previousElementSibling")))};
w.prototype.siblings=function(){var a=this[0];return this.parent().children().filter(function(b,c){return c!==a})};"undefined"!==typeof exports?module.exports=B:f.cash=f.$=B;
'use strict';var e=document,f=window,k=e.createElement("div"),l=Array.prototype,m=l.filter,n=l.indexOf,aa=l.map,q=l.push,r=l.reverse,t=l.slice,u=l.some,ba=l.splice,ca=/^#[\w-]*$/,da=/^\.[\w-]*$/,ea=/<.+>/,fa=/^\w+$/;function v(a,b){void 0===b&&(b=e);return da.test(a)?b.getElementsByClassName(a.slice(1)):fa.test(a)?b.getElementsByTagName(a):b.querySelectorAll(a)}
var w=function(){function a(a,c){void 0===c&&(c=e);if(a){if(a instanceof w)return a;var b=a;if(x(a)){if(b=c instanceof w?c[0]:c,b=ca.test(a)?b.getElementById(a.slice(1)):ea.test(a)?y(a):v(a,b),!b)return}else if(z(a))return this.ready(a);if(b.nodeType||b===f)b=[b];this.length=b.length;a=0;for(c=this.length;a<c;a++)this[a]=b[a]}}a.prototype.init=function(b,c){return new a(b,c)};return a}(),A=w.prototype.init;A.fn=A.prototype=w.prototype;w.prototype.length=0;w.prototype.splice=ba;
w.prototype.get=function(a){return void 0===a?t.call(this):this[0>a?a+this.length:a]};w.prototype.eq=function(a){return A(this.get(a))};w.prototype.first=function(){return this.eq(0)};w.prototype.last=function(){return this.eq(-1)};w.prototype.map=function(a){return A(aa.call(this,function(b,c){return a.call(b,c,b)}))};w.prototype.slice=function(){return A(t.apply(this,arguments))};var ha=/-([a-z])/g;function ia(a,b){return b.toUpperCase()}function B(a){return a.replace(ha,ia)}A.camelCase=B;
function C(a,b){for(var c=0,d=a.length;c<d&&!1!==b.call(a[c],c,a[c]);c++);}A.each=C;w.prototype.each=function(a){C(this,a);return this};w.prototype.removeProp=function(a){return this.each(function(b,c){delete c[a]})};function D(a){for(var b=1;b<arguments.length;b++);b=arguments;for(var c=b.length,d=2>c?0:1;d<c;d++)for(var g in b[d])a[g]=b[d][g];return a}w.prototype.extend=function(a){return D(A.fn,a)};A.extend=D;var E=1;A.guid=E;
function F(a,b){var c=a&&(a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector);return!!c&&c.call(a,b)}A.matches=F;function G(a,b,c){for(var d=[],g=0,h=a.length;g<h;g++)for(var p=a[g][b];null!=p;){d.push(p);if(!c)break;p=p[b]}return d}function z(a){return"function"===typeof a}function x(a){return"string"===typeof a}function H(a){return!isNaN(parseFloat(a))&&isFinite(a)}var I=Array.isArray;A.isFunction=z;A.isString=x;A.isNumeric=H;A.isArray=I;
w.prototype.prop=function(a,b){if(a){if(x(a))return 2>arguments.length?this[0]&&this[0][a]:this.each(function(c,g){g[a]=b});for(var c in a)this.prop(c,a[c]);return this}};function J(a){return x(a)?function(b,c){return F(c,a)}:z(a)?a:a instanceof w?function(b,c){return a.is(c)}:function(b,c){return c===a}}w.prototype.filter=function(a){if(!a)return A();var b=J(a);return A(m.call(this,function(a,d){return b.call(a,d,a)}))};function K(a,b){return b&&a.length?a.filter(b):a}var ja=/\S+/g;
function L(a){return x(a)?a.match(ja)||[]:[]}w.prototype.hasClass=function(a){return a&&u.call(this,function(b){return b.classList.contains(a)})};w.prototype.removeAttr=function(a){var b=L(a);return b.length?this.each(function(a,d){C(b,function(a,b){d.removeAttribute(b)})}):this};
w.prototype.attr=function(a,b){if(a){if(x(a)){if(2>arguments.length){if(!this[0])return;var c=this[0].getAttribute(a);return null===c?void 0:c}return null===b?this.removeAttr(a):this.each(function(c,g){g.setAttribute(a,b)})}for(c in a)this.attr(c,a[c]);return this}};w.prototype.toggleClass=function(a,b){var c=L(a),d=void 0!==b;return c.length?this.each(function(a,h){C(c,function(a,c){d?b?h.classList.add(c):h.classList.remove(c):h.classList.toggle(c)})}):this};
w.prototype.addClass=function(a){return this.toggleClass(a,!0)};w.prototype.removeClass=function(a){return arguments.length?this.toggleClass(a,!1):this.attr("class","")};function M(a){return 1<a.length?m.call(a,function(a,c,d){return n.call(d,a)===c}):a}A.unique=M;w.prototype.add=function(a,b){return A(M(this.get().concat(A(a,b).get())))};function N(a,b,c){if(1===a.nodeType&&b)return a=f.getComputedStyle(a,null),b?c?a.getPropertyValue(b)||void 0:a[b]:a}
function O(a,b){return parseInt(N(a,b),10)||0}var P=/^--/,R={},ka=k.style,la=["webkit","moz","ms","o"];function S(a,b){void 0===b&&(b=P.test(a));if(b)return a;if(!R[a]){b=B(a);var c=""+b.charAt(0).toUpperCase()+b.slice(1);b=(b+" "+la.join(c+" ")+c).split(" ");C(b,function(b,c){if(c in ka)return R[a]=c,!1})}return R[a]}A.prefixedProp=S;var ma={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};
function T(a,b,c){void 0===c&&(c=P.test(a));return c||ma[a]||!H(b)?b:b+"px"}w.prototype.css=function(a,b){if(x(a)){var c=P.test(a);a=S(a,c);if(2>arguments.length)return this[0]&&N(this[0],a,c);if(!a)return this;b=T(a,b,c);return this.each(function(d,h){1===h.nodeType&&(c?h.style.setProperty(a,b):h.style[a]=b)})}for(var d in a)this.css(d,a[d]);return this};var na=/^data-(.*)/;A.hasData=function(a){return"__cashData"in a};function U(a){return a.__cashData=a.__cashData||{}}
function oa(a,b){var c=U(a);if(b){if(!(b in c)&&(a=a.dataset?a.dataset[b]||a.dataset[B(b)]:A(a).attr("data-"+b),void 0!==a)){try{a=JSON.parse(a)}catch(d){}c[b]=a}return c[b]}return c}w.prototype.data=function(a,b){var c=this;if(!a){if(!this[0])return;C(this[0].attributes,function(a,b){(a=b.name.match(na))&&c.data(a[1])});return oa(this[0])}if(x(a))return void 0===b?this[0]&&oa(this[0],a):this.each(function(c,d){U(d)[a]=b});for(var d in a)this.data(d,a[d]);return this};
w.prototype.removeData=function(a){return this.each(function(b,c){void 0===a?delete c.__cashData:delete U(c)[a]})};function pa(a,b){return O(a,"border"+(b?"Left":"Top")+"Width")+O(a,"padding"+(b?"Left":"Top"))+O(a,"padding"+(b?"Right":"Bottom"))+O(a,"border"+(b?"Right":"Bottom")+"Width")}C(["Width","Height"],function(a,b){w.prototype["inner"+b]=function(){if(this[0])return this[0]===f?f["inner"+b]:this[0]["client"+b]}});
C(["width","height"],function(a,b){w.prototype[b]=function(c){if(!this[0])return void 0===c?void 0:this;if(!arguments.length)return this[0]===f?this[0][B("outer-"+b)]:this[0].getBoundingClientRect()[b]-pa(this[0],!a);var d=parseInt(c,10);return this.each(function(c,h){1===h.nodeType&&(c=N(h,"boxSizing"),h.style[b]=T(b,d+("border-box"===c?pa(h,!a):0)))})}});
C(["Width","Height"],function(a,b){w.prototype["outer"+b]=function(c){if(this[0])return this[0]===f?f["outer"+b]:this[0]["offset"+b]+(c?O(this[0],"margin"+(a?"Top":"Left"))+O(this[0],"margin"+(a?"Bottom":"Right")):0)}});var V={};
w.prototype.toggle=function(a){return this.each(function(b,c){if(a=void 0!==a?a:"none"===N(c,"display")){if(c.style.display="","none"===N(c,"display")){b=c.style;c=c.tagName;if(V[c])c=V[c];else{var d=e.createElement(c);e.body.appendChild(d);var g=N(d,"display");e.body.removeChild(d);c=V[c]="none"!==g?g:"block"}b.display=c}}else c.style.display="none"})};w.prototype.hide=function(){return this.toggle(!1)};w.prototype.show=function(){return this.toggle(!0)};
function qa(a,b){return!b||!u.call(b,function(b){return 0>a.indexOf(b)})}function ra(a,b,c,d){d.guid=d.guid||E++;var g=a.__cashEvents=a.__cashEvents||{};g[b]=g[b]||[];g[b].push([c,d]);a.addEventListener(b,d)}function W(a){a=a.split(".");return[a[0],a.slice(1).sort()]}
function X(a,b,c,d){var g=a.__cashEvents=a.__cashEvents||{};if(b)g[b]&&(g[b]=g[b].filter(function(g){var h=g[0];g=g[1];if(d&&g.guid!==d.guid||!qa(h,c))return!0;a.removeEventListener(b,g)}));else{for(b in g)X(a,b,c,d);delete a.__cashEvents}}w.prototype.off=function(a,b){var c=this;void 0===a?this.each(function(a,b){return X(b)}):C(L(a),function(a,g){a=W(g);var d=a[0],p=a[1];c.each(function(a,c){return X(c,d,p,b)})});return this};
w.prototype.on=function(a,b,c,d){var g=this;if(!x(a)){for(var h in a)this.on(h,b,a[h]);return this}z(b)&&(c=b,b="");C(L(a),function(a,h){a=W(h);var p=a[0],Q=a[1];g.each(function(a,g){a=function ua(a){if(!a.namespace||qa(Q,a.namespace.split("."))){var h=g;if(b)for(h=a.target;!F(h,b);){if(h===g)return;h=h.parentNode;if(!h)return}a.namespace=a.namespace||"";h=c.call(h,a,a.data);d&&X(g,p,Q,ua);!1===h&&(a.preventDefault(),a.stopPropagation())}};a.guid=c.guid=c.guid||E++;ra(g,p,Q,a)})});return this};
w.prototype.one=function(a,b,c){return this.on(a,b,c,!0)};w.prototype.ready=function(a){function b(){return a(A)}"loading"!==e.readyState?setTimeout(b):e.addEventListener("DOMContentLoaded",b);return this};w.prototype.trigger=function(a,b){var c=a;if(x(a)){var d=W(a);a=d[0];d=d[1];c=e.createEvent("HTMLEvents");c.initEvent(a,!0,!0);c.namespace=d.join(".")}c.data=b;return this.each(function(a,b){b.dispatchEvent(c)})};
function sa(a){return a.multiple?G(m.call(a.options,function(a){return a.selected&&!a.disabled&&!a.parentNode.disabled}),"value"):a.value||""}var ta=/%20/g,va=/file|reset|submit|button|image/i,wa=/radio|checkbox/i;
w.prototype.serialize=function(){var a="";this.each(function(b,c){C(c.elements||[c],function(b,c){c.disabled||!c.name||"FIELDSET"===c.tagName||va.test(c.type)||wa.test(c.type)&&!c.checked||(b=sa(c),void 0!==b&&(b=I(b)?b:[b],C(b,function(b,d){b=a;d="&"+encodeURIComponent(c.name)+"="+encodeURIComponent(d).replace(ta,"+");a=b+d})))})});return a.substr(1)};
w.prototype.val=function(a){return void 0===a?this[0]&&sa(this[0]):this.each(function(b,c){if("SELECT"===c.tagName){var d=I(a)?a:null===a?[]:[a];C(c.options,function(a,b){b.selected=0<=d.indexOf(b.value)})}else c.value=null===a?"":a})};w.prototype.clone=function(){return this.map(function(a,b){return b.cloneNode(!0)})};w.prototype.detach=function(){return this.each(function(a,b){b.parentNode&&b.parentNode.removeChild(b)})};var xa=/^\s*<(\w+)[^>]*>/,ya=/^\s*<(\w+)\s*\/?>(?:<\/\1>)?\s*$/,Y;
function y(a){if(!Y){var b=e.createElement("table"),c=e.createElement("tr");Y={"*":k,tr:e.createElement("tbody"),td:c,th:c,thead:b,tbody:b,tfoot:b}}if(!x(a))return[];if(ya.test(a))return[e.createElement(RegExp.$1)];b=xa.test(a)&&RegExp.$1;b=Y[b]||Y["*"];b.innerHTML=a;return A(b.childNodes).detach().get()}A.parseHTML=y;w.prototype.empty=function(){var a=this[0];if(a)for(;a.firstChild;)a.removeChild(a.firstChild);return this};
function Z(a,b,c){C(a,function(a,g){C(b,function(b,d){b=a?d.cloneNode(!0):d;c?g.insertBefore(b,g.childNodes[0]):g.appendChild(b)})})}w.prototype.append=function(){var a=this;C(arguments,function(b,c){Z(a,A(c))});return this};w.prototype.appendTo=function(a){Z(A(a),this);return this};w.prototype.html=function(a){return void 0===a?this[0]&&this[0].innerHTML:this.each(function(b,c){c.innerHTML=a})};
w.prototype.insertAfter=function(a){var b=this;A(a).each(function(a,d){var c=d.parentNode;c&&b.each(function(b,g){c.insertBefore(a?g.cloneNode(!0):g,d.nextSibling)})});return this};w.prototype.after=function(){var a=this;C(r.apply(arguments),function(b,c){r.apply(A(c).slice()).insertAfter(a)});return this};w.prototype.insertBefore=function(a){var b=this;A(a).each(function(a,d){var c=d.parentNode;c&&b.each(function(b,g){c.insertBefore(a?g.cloneNode(!0):g,d)})});return this};
w.prototype.before=function(){var a=this;C(arguments,function(b,c){A(c).insertBefore(a)});return this};w.prototype.prepend=function(){var a=this;C(arguments,function(b,c){Z(a,A(c),!0)});return this};w.prototype.prependTo=function(a){Z(A(a),r.apply(this.slice()),!0);return this};w.prototype.remove=function(){return this.detach().off()};w.prototype.replaceWith=function(a){return this.before(a).remove()};w.prototype.replaceAll=function(a){A(a).replaceWith(this);return this};
w.prototype.text=function(a){return void 0===a?this[0]?this[0].textContent:"":this.each(function(b,c){c.textContent=a})};w.prototype.unwrap=function(){this.parent().each(function(a,b){a=A(b);a.replaceWith(a.children())});return this};w.prototype.wrapAll=function(a){if(this[0]){a=A(a);this.first().before(a);for(a=a[0];a.children.length;)a=a.firstElementChild;this.appendTo(a)}return this};w.prototype.wrap=function(a){return this.each(function(b,c){var d=A(a)[0];A(c).wrapAll(b?d.cloneNode(!0):d)})};
w.prototype.wrapInner=function(a){return this.each(function(b,c){b=A(c);c=b.contents();c.length?c.wrapAll(a):b.append(a)})};var za=e.documentElement;w.prototype.offset=function(){var a=this[0];if(a)return a=a.getBoundingClientRect(),{top:a.top+f.pageYOffset-za.clientTop,left:a.left+f.pageXOffset-za.clientLeft}};w.prototype.offsetParent=function(){return A(this[0]&&this[0].offsetParent)};w.prototype.position=function(){var a=this[0];if(a)return{left:a.offsetLeft,top:a.offsetTop}};
w.prototype.children=function(a){var b=[];this.each(function(a,d){q.apply(b,d.children)});return K(A(M(b)),a)};w.prototype.contents=function(){var a=[];this.each(function(b,c){q.apply(a,"IFRAME"===c.tagName?[c.contentDocument]:c.childNodes)});return A(M(a))};w.prototype.find=function(a){for(var b=[],c=0,d=this.length;c<d;c++){var g=v(a,this[c]);g.length&&q.apply(b,g)}return A(M(b))};w.prototype.has=function(a){var b=x(a)?function(b,d){return!!v(a,d).length}:function(b,d){return d.contains(a)};return this.filter(b)};
w.prototype.is=function(a){if(!a||!this[0])return!1;var b=J(a),c=!1;this.each(function(a,g){c=b.call(g,a,g);return!c});return c};w.prototype.next=function(a,b){return K(A(M(G(this,"nextElementSibling",b))),a)};w.prototype.nextAll=function(a){return this.next(a,!0)};w.prototype.not=function(a){if(!a||!this[0])return this;var b=J(a);return this.filter(function(a,d){return!b.call(d,a,d)})};w.prototype.parent=function(a){return K(A(M(G(this,"parentNode"))),a)};
w.prototype.index=function(a){var b=a?A(a)[0]:this[0];a=a?this:A(b).parent().children();return n.call(a,b)};w.prototype.closest=function(a){if(!a||!this[0])return A();var b=this.filter(a);return b.length?b:this.parent().closest(a)};w.prototype.parents=function(a){return K(A(M(G(this,"parentElement",!0))),a)};w.prototype.prev=function(a,b){return K(A(M(G(this,"previousElementSibling",b))),a)};w.prototype.prevAll=function(a){return this.prev(a,!0)};
w.prototype.siblings=function(a){var b=this[0];return K(this.parent().children().filter(function(a,d){return d!==b}),a)};"undefined"!==typeof exports?module.exports=A:f.cash=f.$=A;
})();
interface Cash {
[index: number]: Window & Document & HTMLElement & Element; //FIXME: Quick and dirty way of getting rid of most type errors
[index: number]: Window & Document & HTMLElement & Element & Node; //FIXME: Quick and dirty way of getting rid of most type errors
length: number;

@@ -16,3 +16,3 @@ splice ( start: number, deleteCount?: number );

type Ele = Window | Document | HTMLElement | Element;
type Ele = Window | Document | HTMLElement | Element | Node;
type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<any> | Cash;

@@ -293,4 +293,6 @@ type Comparator = string | Function | Ele | Cash;

return !!ele && !!ele.matches && ele.matches ( selector );
const matches = ele && ( ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector'] );
return !!matches && matches.call ( ele, selector );
}

@@ -307,6 +309,24 @@

function pluck ( arr: ArrayLike<any>, prop: string ): ArrayLike<any> {
function pluck ( arr: ArrayLike<any>, prop: string, deep?: boolean ): ArrayLike<any> {
return filter.call ( map.call ( arr, ele => ele[prop] ), ele => ele != null );
const plucked = [];
for ( let i = 0, l = arr.length; i < l; i++ ) {
let val = arr[i][prop];
while ( val != null ) {
plucked.push ( val );
if ( !deep ) break;
val = val[prop];
}
}
return plucked;
}

@@ -407,3 +427,3 @@

Cash.prototype.filter = function ( this: Cash, comparator?: Comparator ) {
Cash.prototype.filter = function ( this: Cash, comparator: Comparator ) {

@@ -419,2 +439,9 @@ if ( !comparator ) return cash ();

// @require collection/filter.ts
function filtered ( collection: Cash, comparator?: Comparator ): Cash {
return !comparator || !collection.length ? collection : collection.filter ( comparator );
}
// @require ./type_checking.ts

@@ -438,3 +465,3 @@

Cash.prototype.hasClass = function ( this: Cash, cls: string ) {
return some.call ( this, ele => ele.classList.contains ( cls ) );
return cls && some.call ( this, ele => ele.classList.contains ( cls ) );
};

@@ -1036,2 +1063,95 @@

// @require css/helpers/compute_style.ts
const defaultDisplay = {};
function getDefaultDisplay ( tagName: string ): string {
if ( defaultDisplay[tagName] ) return defaultDisplay[tagName];
const ele = doc.createElement ( tagName );
doc.body.appendChild ( ele );
const display = computeStyle ( ele, 'display' );
doc.body.removeChild ( ele );
return defaultDisplay[tagName] = display !== 'none' ? display : 'block';
}
// @require css/helpers/compute_style.ts
function isHidden ( ele: HTMLElement ): boolean {
return computeStyle ( ele, 'display' ) === 'none';
}
// @require core/cash.ts
// @require ./helpers/get_default_display.ts
interface Cash {
toggle ( force?: boolean ): this;
}
Cash.prototype.toggle = function ( this: Cash, force?: boolean ) {
return this.each ( ( i, ele ) => {
force = force !== undefined ? force : isHidden ( ele );
if ( force ) {
ele.style.display = '';
if ( isHidden ( ele ) ) {
ele.style.display = getDefaultDisplay ( ele.tagName );
}
} else {
ele.style.display = 'none';
}
});
};
// @require core/cash.ts
// @require ./toggle.ts
interface Cash {
hide (): this;
}
Cash.prototype.hide = function ( this: Cash ) {
return this.toggle ( false );
};
// @require core/cash.ts
// @require ./toggle.ts
interface Cash {
show (): this;
}
Cash.prototype.show = function ( this: Cash ) {
return this.toggle ( true );
};
// @optional ./hide.ts
// @optional ./show.ts
// @optional ./toggle.ts
function hasNamespaces ( ns1: string[], ns2: string[] ): boolean {

@@ -1412,4 +1532,4 @@

function val ( this: Cash ): string | string[];
function val ( this: Cash, value: string ): Cash;
function val ( this: Cash, value?: string ): string | string[] | Cash {
function val ( this: Cash, value: string | string[] ): Cash;
function val ( this: Cash, value?: string | string[] ): string | string[] | Cash {

@@ -1420,6 +1540,5 @@ if ( value === undefined ) return this[0] && getValue ( this[0] );

const isMultiple = ele.multiple,
eleValue = ( value === null ) ? ( isMultiple ? [] : '' ) : value;
if ( ele.tagName === 'SELECT' ) {
if ( isMultiple && isArray ( eleValue ) ) {
const eleValue = isArray ( value ) ? value : ( value === null ? [] : [value] );

@@ -1434,3 +1553,3 @@ each ( ele.options, ( i, option ) => {

ele.value = eleValue;
ele.value = value === null ? '' : value;

@@ -1829,2 +1948,95 @@ }

// @require core/cash.ts
interface Cash {
unwrap (): this;
}
Cash.prototype.unwrap = function ( this: Cash ) {
this.parent ().each ( ( i, ele ) => {
const $ele = cash ( ele );
$ele.replaceWith ( $ele.children () );
});
return this;
};
// @require core/cash.ts
// @require collection/first.ts
// @require manipulation/append_to.ts
interface Cash {
wrapAll ( selector?: Selector ): this;
}
Cash.prototype.wrapAll = function ( this: Cash, selector?: Selector ) {
if ( this[0] ) {
const structure = cash ( selector );
this.first ().before ( structure );
let wrapper = structure[0] as Element;
while ( wrapper.children.length ) wrapper = wrapper.firstElementChild;
this.appendTo ( wrapper );
}
return this;
};
// @require core/cash.ts
// @require collection/each.ts
// @require ./wrap_all.ts
interface Cash {
wrap ( selector?: Selector ): this;
}
Cash.prototype.wrap = function ( this: Cash, selector?: Selector ) {
return this.each ( ( index, ele ) => {
const wrapper = cash ( selector )[0];
cash ( ele ).wrapAll ( !index ? wrapper : wrapper.cloneNode ( true ) );
});
};
// @require core/cash.ts
// @require collection/first.ts
// @require manipulation/append_to.ts
interface Cash {
wrapInner ( selector?: Selector ): this;
}
Cash.prototype.wrapInner = function ( this: Cash, selector?: Selector ) {
return this.each ( ( i, ele ) => {
const $ele = cash ( ele ),
contents = $ele.contents ();
contents.length ? contents.wrapAll ( selector ) : $ele.append ( selector );
});
};
// @optional ./after.ts

@@ -1846,2 +2058,6 @@ // @optional ./append.ts

// @optional ./text.ts
// @optional ./unwrap.ts
// @optional ./wrap.ts
// @optional ./wrap_all.ts
// @optional ./wrap_inner.ts

@@ -1917,2 +2133,3 @@

// @require core/cash.ts
// @require core/filtered.ts
// @require core/unique.ts

@@ -1924,6 +2141,6 @@ // @require core/variables.ts

interface Cash {
children ( selector?: string ): Cash;
children ( comparator?: Comparator ): Cash;
}
Cash.prototype.children = function ( this: Cash, selector?: string ) {
Cash.prototype.children = function ( this: Cash, comparator?: Comparator ) {

@@ -1934,8 +2151,4 @@ let result: Ele[] | Cash = [];

result = cash ( unique ( result ) );
return filtered ( cash ( unique ( result ) ), comparator );
if ( !selector ) return result;
return result.filter ( selector );
};

@@ -2039,2 +2252,3 @@

// @require core/cash.ts
// @require core/filtered.ts
// @require core/pluck.ts

@@ -2044,8 +2258,8 @@ // @require core/unique.ts

interface Cash {
next (): Cash;
next ( comparator?: Comparator, all?: boolean ): Cash;
}
Cash.prototype.next = function ( this: Cash ) {
Cash.prototype.next = function ( this: Cash, comparator?: Comparator, all?: boolean ) {
return cash ( unique ( pluck ( this, 'nextElementSibling' ) ) );
return filtered ( cash ( unique ( pluck ( this, 'nextElementSibling', all ) ) ), comparator );

@@ -2055,2 +2269,15 @@ };

// @require ./next.ts
interface Cash {
nextAll ( comparator?: Comparator): Cash;
}
Cash.prototype.nextAll = function ( this: Cash, comparator?: Comparator ) {
return this.next ( comparator, true );
};
// @require core/cash.ts

@@ -2076,2 +2303,3 @@ // @require core/get_compare_function.ts

// @require core/cash.ts
// @require core/filtered.ts
// @require core/pluck.ts

@@ -2081,8 +2309,8 @@ // @require core/unique.ts

interface Cash {
parent (): Cash;
parent ( comparator?: Comparator ): Cash;
}
Cash.prototype.parent = function ( this: Cash ) {
Cash.prototype.parent = function ( this: Cash, comparator?: Comparator ) {
return cash ( unique ( pluck ( this, 'parentNode' ) ) );
return filtered ( cash ( unique ( pluck ( this, 'parentNode' ) ) ), comparator );

@@ -2130,13 +2358,15 @@ };

interface Cash {
closest ( selector: string ): Cash;
closest ( comparator: Comparator ): Cash;
}
Cash.prototype.closest = function ( this: Cash, selector: string ) {
Cash.prototype.closest = function ( this: Cash, comparator: Comparator ) {
if ( !selector || !this[0] ) return cash ();
if ( !comparator || !this[0] ) return cash ();
if ( this.is ( selector ) ) return this.filter ( selector );
const filtered = this.filter ( comparator );
return this.parent ().closest ( selector );
if ( filtered.length ) return filtered;
return this.parent ().closest ( comparator );
};

@@ -2146,2 +2376,3 @@

// @require core/cash.ts
// @require core/filtered.ts
// @require core/matches.ts

@@ -2153,43 +2384,37 @@ // @require core/unique.ts

interface Cash {
parents ( selector?: string ): Cash;
parents ( comparator?: Comparator ): Cash;
}
Cash.prototype.parents = function ( this: Cash, selector?: string ) {
Cash.prototype.parents = function ( this: Cash, comparator?: Comparator ) {
const result: Ele[] = [];
return filtered ( cash ( unique ( pluck ( this, 'parentElement', true ) ) ), comparator );
let last;
};
this.each ( ( i, ele ) => {
last = ele;
// @require core/cash.ts
// @require core/filtered.ts
// @require core/pluck.ts
// @require core/unique.ts
while ( last && last.parentNode && last !== doc.body.parentNode ) {
interface Cash {
prev ( comparator?: Comparator, all?: boolean ): Cash;
}
last = last.parentNode;
Cash.prototype.prev = function ( this: Cash, comparator?: Comparator, all?: boolean ) {
if ( !selector || ( selector && matches ( last, selector ) ) ) {
result.push ( last );
}
return filtered ( cash ( unique ( pluck ( this, 'previousElementSibling', all ) ) ), comparator );
}
});
return cash ( unique ( result ) );
};
// @require core/cash.ts
// @require core/pluck.ts
// @require core/unique.ts
// @require ./prev.ts
interface Cash {
prev (): Cash;
prevAll ( comparator?: Comparator ): Cash;
}
Cash.prototype.prev = function ( this: Cash ) {
Cash.prototype.prevAll = function ( this: Cash, comparator?: Comparator ) {
return cash ( unique ( pluck ( this, 'previousElementSibling' ) ) );
return this.prev ( comparator, true );

@@ -2200,2 +2425,3 @@ };

// @require core/cash.ts
// @require core/filtered.ts
// @require collection/filter.ts

@@ -2206,10 +2432,10 @@ // @require ./children.ts

interface Cash {
siblings (): Cash;
siblings ( comparator?: Comparator ): Cash;
}
Cash.prototype.siblings = function ( this: Cash ) {
Cash.prototype.siblings = function ( this: Cash, comparator?: Comparator ) {
const ele = this[0];
return this.parent ().children ().filter ( ( i, child ) => child !== ele );
return filtered ( this.parent ().children ().filter ( ( i, child ) => child !== ele ), comparator );

@@ -2238,2 +2464,3 @@ };

// @optional dimensions/index.ts
// @optional effects/index.ts
// @optional events/index.ts

@@ -2240,0 +2467,0 @@ // @optional forms/index.ts

@@ -19,48 +19,48 @@

},
win_edge_17: {
win_edge: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: '17.17134',
version: 'latest',
platform: 'Windows 10'
},
win_chrome_60: {
win_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
version: '60.0',
version: 'latest-5',
platform: 'Windows 10'
},
win_firefox_50: {
win_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
version: '50.0',
version: 'latest-5',
platform: 'Windows 10'
},
linux_chrome_45: {
linux_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
version: '45.0',
version: 'latest',
platform: 'Linux'
},
linux_firefox_45: {
linux_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
version: '45.0',
version: 'latest',
platform: 'Linux'
},
mac_chrome_60: {
mac_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
version: '60.0',
version: 'latest-5',
platform: 'macOS 10.13'
},
mac_firefox_50: {
mac_firefox: {
base: 'SauceLabs',
browserName: 'firefox',
version: '50.0',
version: 'latest-5',
platform: 'macOS 10.13'
},
mac_safari_12: {
mac_safari: {
base: 'SauceLabs',
browserName: 'safari',
version: '12.0',
version: 'latest',
platform: 'macOS 10.13'

@@ -115,2 +115,3 @@ },

'test/modules/dimensions.js',
'test/modules/effects.js',
'test/modules/events.js',

@@ -117,0 +118,0 @@ 'test/modules/forms.js',

{
"name": "cash-dom",
"description": "An absurdly small jQuery alternative for modern browsers.",
"version": "3.0.0-beta.0",
"version": "3.0.0-beta.1",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "./dist/cash.js",

@@ -8,3 +8,3 @@

Cash is an absurdly small jQuery alternative for modern browsers (IE10+) that provides jQuery-style syntax for manipulating the DOM. Utilizing modern browser features to minimize the codebase, developers can use the familiar chainable methods at a fraction of the file size. 100% feature parity with jQuery isn't a goal, but cash comes helpfully close, covering most day to day use cases.
Cash is an absurdly small jQuery alternative for modern browsers (IE10+) that provides jQuery-style syntax for manipulating the DOM. Utilizing modern browser features to minimize the codebase, developers can use the familiar chainable methods at a fraction of the file size. 100% feature parity with jQuery isn't a goal, but Cash comes helpfully close, covering most day to day use cases.

@@ -30,12 +30,14 @@ ## Comparison

If you're migrating from jQuery be sure to read our [migration guide](https://github.com/kenwheeler/cash/blob/master/docs/migration_guide.md).
## Usage
Get cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/3.0.0-beta.0/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@3.0.0-beta.0/dist/cash.min.js) and use it like this:
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/3.0.0-beta.1/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@3.0.0-beta.1/dist/cash.min.js) and use it like this:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/3.0.0-beta.0/cash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/3.0.0-beta.1/cash.min.js"></script>
<script>
$(function () {
$('html').addClass ( 'dom-loaded' );
$('<footer>Appended with cash</footer>').appendTo ( document.body );
$('<footer>Appended with Cash</footer>').appendTo ( document.body );
});

@@ -57,3 +59,3 @@ </script>

This is the main selector method for cash. It returns an actionable collection of nodes.
This is the main selector method for Cash. It returns an actionable collection of nodes.

@@ -79,40 +81,45 @@ If a function is provided, the function will be run once the DOM is ready.

| Attributes | Collection | CSS | Data | Dimensions | Events |
| ------------------------------------ | -------------------------- | -------------------- | ---------------------------------- | ------------------------------------ | ---------------------------- |
| [fn.addClass ()](#fnaddclass-) | [fn.add ()](#fnadd-) | [fn.css ()](#fncss-) | [fn.data ()](#fndata-) | [fn.height ()](#fnheight-) | [fn.off ()](#fnoff-) |
| [fn.attr ()](#fnattr-) | [fn.each ()](#fneach-) | | [fn.removeData ()](#fnremovedata-) | [fn.innerHeight ()](#fninnerheight-) | [fn.on ()](#fnon-) |
| [fn.hasClass ()](#fnhasclass-) | [fn.eq ()](#fneq-) | | | [fn.innerWidth ()](#fninnerwidth-) | [fn.one ()](#fnone-) |
| [fn.prop ()](#fnprop-) | [fn.filter ()](#fnfilter-) | | | [fn.outerHeight ()](#fnouterheight-) | [fn.ready ()](#fnready-) |
| [fn.removeAttr ()](#fnremoveattr-) | [fn.first ()](#fnfirst-) | | | [fn.outerWidth ()](#fnouterwidth-) | [fn.trigger ()](#fntrigger-) |
| [fn.removeClass ()](#fnremoveclass-) | [fn.get ()](#fnget-) | | | [fn.width ()](#fnwidth-) | |
| [fn.removeProp ()](#fnremoveprop-) | [fn.index ()](#fnindex-) | | | | |
| [fn.toggleClass ()](#fntoggleclass-) | [fn.last ()](#fnlast-) | | | | |
| | [fn.map ()](#fnmap-) | | | | |
| | [fn.slice ()](#fnslice-) | | | | |
| Attributes | Collection | CSS | Data | Dimensions | Effects |
| ------------------------------------ | -------------------------- | -------------------- | ---------------------------------- | ------------------------------------ | -------------------------- |
| [fn.addClass ()](#fnaddclass-) | [fn.add ()](#fnadd-) | [fn.css ()](#fncss-) | [fn.data ()](#fndata-) | [fn.height ()](#fnheight-) | [fn.hide ()](#fnhide-) |
| [fn.attr ()](#fnattr-) | [fn.each ()](#fneach-) | | [fn.removeData ()](#fnremovedata-) | [fn.innerHeight ()](#fninnerheight-) | [fn.show ()](#fnshow-) |
| [fn.hasClass ()](#fnhasclass-) | [fn.eq ()](#fneq-) | | | [fn.innerWidth ()](#fninnerwidth-) | [fn.toggle ()](#fntoggle-) |
| [fn.prop ()](#fnprop-) | [fn.filter ()](#fnfilter-) | | | [fn.outerHeight ()](#fnouterheight-) | |
| [fn.removeAttr ()](#fnremoveattr-) | [fn.first ()](#fnfirst-) | | | [fn.outerWidth ()](#fnouterwidth-) | |
| [fn.removeClass ()](#fnremoveclass-) | [fn.get ()](#fnget-) | | | [fn.width ()](#fnwidth-) | |
| [fn.removeProp ()](#fnremoveprop-) | [fn.index ()](#fnindex-) | | | | |
| [fn.toggleClass ()](#fntoggleclass-) | [fn.last ()](#fnlast-) | | | | |
| | [fn.map ()](#fnmap-) | | | | |
| | [fn.slice ()](#fnslice-) | | | | |
| Forms | Manipulation | Offset | Traversal |
| -------------------------------- | -------------------------------------- | -------------------------------------- | ------------------------------ |
| [fn.serialize ()](#fnserialize-) | [fn.after ()](#fnafter-) | [fn.offset ()](#fnoffset-) | [fn.children ()](#fnchildren-) |
| [fn.val ()](#fnval-) | [fn.append ()](#fnappend-) | [fn.offsetParent ()](#fnoffsetparent-) | [fn.closest ()](#fnclosest-) |
| | [fn.appendTo ()](#fnappendto-) | [fn.position ()](#fnposition-) | [fn.contents ()](#fncontents-) |
| | [fn.before ()](#fnbefore-) | | [fn.find ()](#fnfind-) |
| | [fn.clone ()](#fnclone-) | | [fn.has ()](#fnhas-) |
| | [fn.detach ()](#fndetach-) | | [fn.is ()](#fnis-) |
| | [fn.empty ()](#fnempty-) | | [fn.next ()](#fnnext-) |
| | [fn.html ()](#fnhtml-) | | [fn.not ()](#fnnot-) |
| | [fn.insertAfter ()](#fninsertafter-) | | [fn.parent ()](#fnparent-) |
| | [fn.insertBefore ()](#fninsertbefore-) | | [fn.parents ()](#fnparents-) |
| | [fn.prepend ()](#fnprepend-) | | [fn.prev ()](#fnprev-) |
| | [fn.prependTo ()](#fnprependto-) | | [fn.siblings ()](#fnsiblings-) | |
| | [fn.remove ()](#fnremove-) | | |
| | [fn.replaceAll ()](#fnreplaceall-) | | |
| | [fn.replaceWith ()](#fnreplacewith-) | | |
| | [fn.text ()](#fntext-) | | |
| Events | Forms | Manipulation | Offset | Traversal |
| ---------------------------- | -------------------------------- | -------------------------------------- | -------------------------------------- | ------------------------------ |
| [fn.off ()](#fnoff-) | [fn.serialize ()](#fnserialize-) | [fn.after ()](#fnafter-) | [fn.offset ()](#fnoffset-) | [fn.children ()](#fnchildren-) |
| [fn.on ()](#fnon-) | [fn.val ()](#fnval-) | [fn.append ()](#fnappend-) | [fn.offsetParent ()](#fnoffsetparent-) | [fn.closest ()](#fnclosest-) |
| [fn.one ()](#fnone-) | | [fn.appendTo ()](#fnappendto-) | [fn.position ()](#fnposition-) | [fn.contents ()](#fncontents-) |
| [fn.ready ()](#fnready-) | | [fn.before ()](#fnbefore-) | | [fn.find ()](#fnfind-) |
| [fn.trigger ()](#fntrigger-) | | [fn.clone ()](#fnclone-) | | [fn.has ()](#fnhas-) |
| | | [fn.detach ()](#fndetach-) | | [fn.is ()](#fnis-) |
| | | [fn.empty ()](#fnempty-) | | [fn.next ()](#fnnext-) |
| | | [fn.html ()](#fnhtml-) | | [fn.nextAll ()](#fnnextall-) |
| | | [fn.insertAfter ()](#fninsertafter-) | | [fn.not ()](#fnnot-) |
| | | [fn.insertBefore ()](#fninsertbefore-) | | [fn.parent ()](#fnparent-) |
| | | [fn.prepend ()](#fnprepend-) | | [fn.parents ()](#fnparents-) |
| | | [fn.prependTo ()](#fnprependto-) | | [fn.prev ()](#fnprev-) |
| | | [fn.remove ()](#fnremove-) | | [fn.prevAll ()](#fnprevall-) |
| | | [fn.replaceAll ()](#fnreplaceall-) | | [fn.siblings ()](#fnsiblings-) |
| | | [fn.replaceWith ()](#fnreplacewith-) | | |
| | | [fn.text ()](#fntext-) | | |
| | | [fn.unwrap ()](#fnunwrap-) | | |
| | | [fn.wrap ()](#fnwrap-) | | |
| | | [fn.wrapAll ()](#fnwrapall-) | | |
| | | [fn.wrapInner ()](#fnwrapinner-) | | |
#### $.fn
The main prototype for collections, allowing you to extend cash with plugins by adding methods to all collections.
The main prototype for collections, allowing you to extend Cash with plugins by adding methods to all collections.
```js
$.fn // => cash.prototype
$.fn // => Cash.prototype
$.fn.myMethod = function () {}; // Custom method added to all collections

@@ -294,3 +301,3 @@ $.fn.extend ( object ); // Add multiple methods to the prototype

Adds properties to the cash collection prototype.
Adds properties to the Cash collection prototype.

@@ -361,2 +368,10 @@ ```js

#### fn.hide ()
Hide the elements.
```js
$(element).hide () // => collection
```
#### fn.html ()

@@ -442,4 +457,14 @@

$(element).next () // => collection
$(element).next ( selector ) // => collection
```
#### fn.nextAll ()
Returns all the next elements.
```js
$(element).nextAll () // => collection
$(element).nextAll ( selector ) // => collection
```
#### fn.not ()

@@ -533,3 +558,4 @@

```js
$(element).parent() // => collection
$(element).parent () // => collection
$(element).parent ( selector ) // => collection
```

@@ -578,4 +604,14 @@

$(element).prev () // => collection
$(element).prev ( selector ) // => collection
```
#### fn.prevAll ()
Returns all the previous elements.
```js
$(element).prevAll () // => collection
$(element).prevAll ( selector ) // => collection
```
#### fn.prop ()

@@ -673,2 +709,10 @@

#### fn.show ()
Show the elements.
```js
$(element).show () // => collection
```
#### fn.siblings ()

@@ -680,2 +724,3 @@

$(element).siblings () // => collection
$(element).siblings ( selector ) // => collection
```

@@ -700,2 +745,10 @@

#### fn.toggle ()
Hide or show the elements.
```js
$(element).toggle () // => collection
```
#### fn.toggleClass ()

@@ -723,2 +776,10 @@

#### fn.unwrap ()
Removes the wrapper from all elements.
```js
$(element).unwrap () // => collection
```
#### fn.val ()

@@ -742,2 +803,26 @@

#### fn.wrap ()
Wraps a structure around each element.
```js
$(element).wrap ( structure ) // => collection
```
#### fn.wrapAll ()
Wraps a structure around all elements.
```js
$(element).wrapAll ( structure ) // => collection
```
#### fn.wrapInner ()
Wraps a structure around all children.
```js
$(element).wrapInner ( structure ) // => collection
```
### Cash Methods

@@ -789,3 +874,3 @@

Extends target object with properties from the source object. If no target is provided, cash itself will be extended.
Extends target object with properties from the source object.

@@ -798,3 +883,3 @@ ```js

Determine whether an element has any cash data associated with it.
Determine whether an element has any Cash data associated with it.

@@ -879,3 +964,3 @@ ```js

3. Install the dependencies: `npm install`.
4. Automatically recompile cash whenever a change is made: `npm run dev`.
4. Automatically recompile Cash whenever a change is made: `npm run dev`.
5. Automatically rerun the tests whenever a change is made: `npm run test:watch`.

@@ -882,0 +967,0 @@ 6. Remember to update the readme, if necessary.

@@ -11,3 +11,3 @@

Cash.prototype.hasClass = function ( this: Cash, cls: string ) {
return some.call ( this, ele => ele.classList.contains ( cls ) );
return cls && some.call ( this, ele => ele.classList.contains ( cls ) );
};

@@ -12,3 +12,3 @@

Cash.prototype.filter = function ( this: Cash, comparator?: Comparator ) {
Cash.prototype.filter = function ( this: Cash, comparator: Comparator ) {

@@ -15,0 +15,0 @@ if ( !comparator ) return cash ();

@@ -6,4 +6,6 @@

return !!ele && !!ele.matches && ele.matches ( selector );
const matches = ele && ( ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector'] );
return !!matches && matches.call ( ele, selector );
}

@@ -10,0 +12,0 @@

// @require ./variables.ts
function pluck ( arr: ArrayLike<any>, prop: string ): ArrayLike<any> {
function pluck ( arr: ArrayLike<any>, prop: string, deep?: boolean ): ArrayLike<any> {
return filter.call ( map.call ( arr, ele => ele[prop] ), ele => ele != null );
const plucked = [];
for ( let i = 0, l = arr.length; i < l; i++ ) {
let val = arr[i][prop];
while ( val != null ) {
plucked.push ( val );
if ( !deep ) break;
val = val[prop];
}
}
return plucked;
}
interface Cash {
[index: number]: Window & Document & HTMLElement & Element; //FIXME: Quick and dirty way of getting rid of most type errors
[index: number]: Window & Document & HTMLElement & Element & Node; //FIXME: Quick and dirty way of getting rid of most type errors
length: number;

@@ -16,5 +16,5 @@ splice ( start: number, deleteCount?: number );

type Ele = Window | Document | HTMLElement | Element;
type Ele = Window | Document | HTMLElement | Element | Node;
type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<any> | Cash;
type Comparator = string | Function | Ele | Cash;
type Context = Document | HTMLElement | Element;

@@ -14,4 +14,4 @@

function val ( this: Cash ): string | string[];
function val ( this: Cash, value: string ): Cash;
function val ( this: Cash, value?: string ): string | string[] | Cash {
function val ( this: Cash, value: string | string[] ): Cash;
function val ( this: Cash, value?: string | string[] ): string | string[] | Cash {

@@ -22,6 +22,5 @@ if ( value === undefined ) return this[0] && getValue ( this[0] );

const isMultiple = ele.multiple,
eleValue = ( value === null ) ? ( isMultiple ? [] : '' ) : value;
if ( ele.tagName === 'SELECT' ) {
if ( isMultiple && isArray ( eleValue ) ) {
const eleValue = isArray ( value ) ? value : ( value === null ? [] : [value] );

@@ -36,3 +35,3 @@ each ( ele.options, ( i, option ) => {

ele.value = eleValue;
ele.value = value === null ? '' : value;

@@ -39,0 +38,0 @@ }

@@ -7,2 +7,3 @@

// @optional dimensions/index.ts
// @optional effects/index.ts
// @optional events/index.ts

@@ -9,0 +10,0 @@ // @optional forms/index.ts

@@ -18,1 +18,5 @@

// @optional ./text.ts
// @optional ./unwrap.ts
// @optional ./wrap.ts
// @optional ./wrap_all.ts
// @optional ./wrap_inner.ts
// @require core/cash.ts
// @require core/filtered.ts
// @require core/unique.ts

@@ -9,6 +10,6 @@ // @require core/variables.ts

interface Cash {
children ( selector?: string ): Cash;
children ( comparator?: Comparator ): Cash;
}
Cash.prototype.children = function ( this: Cash, selector?: string ) {
Cash.prototype.children = function ( this: Cash, comparator?: Comparator ) {

@@ -19,8 +20,4 @@ let result: Ele[] | Cash = [];

result = cash ( unique ( result ) );
return filtered ( cash ( unique ( result ) ), comparator );
if ( !selector ) return result;
return result.filter ( selector );
};

@@ -8,13 +8,15 @@

interface Cash {
closest ( selector: string ): Cash;
closest ( comparator: Comparator ): Cash;
}
Cash.prototype.closest = function ( this: Cash, selector: string ) {
Cash.prototype.closest = function ( this: Cash, comparator: Comparator ) {
if ( !selector || !this[0] ) return cash ();
if ( !comparator || !this[0] ) return cash ();
if ( this.is ( selector ) ) return this.filter ( selector );
const filtered = this.filter ( comparator );
return this.parent ().closest ( selector );
if ( filtered.length ) return filtered;
return this.parent ().closest ( comparator );
};
// @require core/cash.ts
// @require core/filtered.ts
// @require core/pluck.ts

@@ -7,9 +8,9 @@ // @require core/unique.ts

interface Cash {
next (): Cash;
next ( comparator?: Comparator, all?: boolean ): Cash;
}
Cash.prototype.next = function ( this: Cash ) {
Cash.prototype.next = function ( this: Cash, comparator?: Comparator, all?: boolean ) {
return cash ( unique ( pluck ( this, 'nextElementSibling' ) ) );
return filtered ( cash ( unique ( pluck ( this, 'nextElementSibling', all ) ) ), comparator );
};
// @require core/cash.ts
// @require core/filtered.ts
// @require core/pluck.ts

@@ -7,9 +8,9 @@ // @require core/unique.ts

interface Cash {
parent (): Cash;
parent ( comparator?: Comparator ): Cash;
}
Cash.prototype.parent = function ( this: Cash ) {
Cash.prototype.parent = function ( this: Cash, comparator?: Comparator ) {
return cash ( unique ( pluck ( this, 'parentNode' ) ) );
return filtered ( cash ( unique ( pluck ( this, 'parentNode' ) ) ), comparator );
};
// @require core/cash.ts
// @require core/filtered.ts
// @require core/matches.ts

@@ -9,29 +10,9 @@ // @require core/unique.ts

interface Cash {
parents ( selector?: string ): Cash;
parents ( comparator?: Comparator ): Cash;
}
Cash.prototype.parents = function ( this: Cash, selector?: string ) {
Cash.prototype.parents = function ( this: Cash, comparator?: Comparator ) {
const result: Ele[] = [];
return filtered ( cash ( unique ( pluck ( this, 'parentElement', true ) ) ), comparator );
let last;
this.each ( ( i, ele ) => {
last = ele;
while ( last && last.parentNode && last !== doc.body.parentNode ) {
last = last.parentNode;
if ( !selector || ( selector && matches ( last, selector ) ) ) {
result.push ( last );
}
}
});
return cash ( unique ( result ) );
};
// @require core/cash.ts
// @require core/filtered.ts
// @require core/pluck.ts

@@ -7,9 +8,9 @@ // @require core/unique.ts

interface Cash {
prev (): Cash;
prev ( comparator?: Comparator, all?: boolean ): Cash;
}
Cash.prototype.prev = function ( this: Cash ) {
Cash.prototype.prev = function ( this: Cash, comparator?: Comparator, all?: boolean ) {
return cash ( unique ( pluck ( this, 'previousElementSibling' ) ) );
return filtered ( cash ( unique ( pluck ( this, 'previousElementSibling', all ) ) ), comparator );
};
// @require core/cash.ts
// @require core/filtered.ts
// @require collection/filter.ts

@@ -8,11 +9,11 @@ // @require ./children.ts

interface Cash {
siblings (): Cash;
siblings ( comparator?: Comparator ): Cash;
}
Cash.prototype.siblings = function ( this: Cash ) {
Cash.prototype.siblings = function ( this: Cash, comparator?: Comparator ) {
const ele = this[0];
return this.parent ().children ().filter ( ( i, child ) => child !== ele );
return filtered ( this.parent ().children ().filter ( ( i, child ) => child !== ele ), comparator );
};

@@ -89,1 +89,7 @@

}
/* SUPPORTS */
var Supports = {
CSSvariables: window.CSS && window.CSS.supports && window.CSS.supports ( '--f:0' )
};

@@ -52,3 +52,3 @@

ele.addClass ( '' );
ele.hasClass ( ' ' ); // Empty spaces will be removed
ele.addClass ( ' ' ); // Empty spaces will be removed
ele.addClass ( undefined );

@@ -153,3 +153,2 @@ ele.addClass ( null );

ele.hasClass ( '' );
ele.hasClass ( ' ' ); // Empty spaces will be removed
ele.hasClass ( undefined );

@@ -156,0 +155,0 @@ ele.hasClass ( null );

@@ -41,17 +41,21 @@

it ( 'supports custom variables', function ( t ) {
if ( Supports.CSSvariables ) {
var ele = $('.css');
it ( 'supports custom variables', function ( t ) {
t.is ( ele.css ( '--foo' ), undefined );
t.is ( ele.css ( '--bar' ), undefined );
var ele = $('.css');
ele.css ( '--foo', 0 );
ele.css ( '--bar', 'content' );
t.is ( ele.css ( '--foo' ), undefined );
t.is ( ele.css ( '--bar' ), undefined );
t.is ( ele.css ( '--foo' ), '0' );
t.is ( ele.css ( '--bar' ), 'content' );
ele.css ( '--foo', 0 );
ele.css ( '--bar', 'content' );
});
t.is ( ele.css ( '--foo' ), '0' );
t.is ( ele.css ( '--bar' ), 'content' );
});
}
it ( 'supports invalid properties', function ( t ) {

@@ -58,0 +62,0 @@

@@ -132,3 +132,3 @@

t.is ( val, '' ); //TODO: Maybe we should get `undefined` here
t.true ( val === '' || val === 'not-selected' ); // This seems a bit browser-dependant, some set it to '', some auto-select the first option instead

@@ -135,0 +135,0 @@ });

@@ -415,2 +415,99 @@

describe ( '$.fn.unwrap', function ( it ) {
it ( 'unwraps each element', function ( t ) {
var anchor = $('.anchor');
anchor.unwrap ();
t.is ( $('.parent').length, 0 );
t.deepEqual ( anchor.parent (), $('#qunit-fixture') );
});
});
describe ( '$.fn.wrap', function ( it ) {
it ( 'wraps a structure around each element', function ( t ) {
var eles = $('.uncle, .aunt');
var wrapper = '<div class="wrapper"></div>';
eles.wrap ( wrapper );
t.is ( eles.parent ().filter ( '.wrapper' ).length, 2 );
});
it ( 'supports nested structures', function ( t ) {
var eles = $('.uncle, .aunt');
var wrapper = '<div class="wrapper"><div class="nested"></div></div>';
eles.wrap ( wrapper );
t.is ( eles.parent ().filter ( '.nested' ).length, 2 );
t.is ( eles.parent ().parent ().filter ( '.wrapper' ).length, 2 );
});
});
describe ( '$.fn.wrapAll', function ( it ) {
it ( 'wraps a structure around all elements', function ( t ) {
var eles = $('.uncle, .aunt');
var wrapper = '<div class="wrapper"></div>';
eles.wrapAll ( wrapper );
t.is ( eles.parent ().filter ( '.wrapper' ).length, 1 );
});
it ( 'supports nested structures', function ( t ) {
var eles = $('.uncle, .aunt');
var wrapper = '<div class="wrapper"><div class="nested"></div></div>';
eles.wrapAll ( wrapper );
t.is ( eles.parent ().filter ( '.nested' ).length, 1 );
t.is ( eles.parent ().parent ().filter ( '.wrapper' ).length, 1 );
});
});
describe ( '$.fn.wrapInner', function ( it ) {
it ( 'wraps a struncture around all contents', function ( t ) {
var eles = $('.anchor, .uncle');
var wrapper = '<div class="wrapper"></div>';
eles.wrapInner ( wrapper );
t.is ( $( eles[0] ).html ().trim (), '<div class="wrapper">content</div>' );
t.is ( $( eles[1] ).html (), '<div class="wrapper"></div>' );
});
it ( 'supports nested structures', function ( t ) {
var eles = $('.anchor, .uncle');
var wrapper = '<div class="wrapper"><div class="nested"></div></div>';
eles.wrapInner ( wrapper );
t.is ( $( eles[0] ).html ().trim (), '<div class="wrapper"><div class="nested">content</div></div>' );
t.is ( $( eles[1] ).html (), '<div class="wrapper"><div class="nested"></div></div>' );
});
});
});

@@ -152,5 +152,31 @@

it ( 'supports selector', function ( t ) {
var child = $('.child');
var next = $('.next');
t.deepEqual ( child.next ( '.next' ), next );
t.is ( child.next ( 'foo' ).length, 0 );
});
});
describe ( '$.fn.nextAll', function ( it ) {
it ( 'gets all the next siblings', function ( t ) {
var anchor = $('.child');
var next = $('.next');
var nextnext = $('.nextnext');
var nexts = anchor.nextAll ();
t.deepEqual ( nexts.length, 2 );
t.deepEqual ( nexts[0], next[0] );
t.deepEqual ( nexts[1], nextnext[0] );
});
});
describe ( '$.fn.not', function ( it ) {

@@ -183,2 +209,12 @@

it ( 'supports selector', function ( t ) {
var child = $('.child');
var parent = $('.parent');
t.deepEqual ( child.parent ( '.parent' ), parent );
t.deepEqual ( child.parent ( 'foo' ).length, 0 );
});
it ( 'doesn\'t throw if there\'s no parent', function ( t ) {

@@ -201,2 +237,10 @@

t.is ( parents.length, 5 );
});
it ( 'stops at <html>', function ( t ) {
var child = $('.child');
var parents = child.parents ();
t.is ( parents.last ()[0], document.documentElement );

@@ -237,4 +281,32 @@

it ( 'supports selector', function ( t ) {
var child = $('.child');
var prev = $('.prev');
t.deepEqual ( child.prev ( '.prev' ), prev );
t.is ( child.prev ( 'foo' ).length, 0 );
});
});
describe ( '$.fn.prevAll', function ( it ) {
it ( 'gets all the previous siblings', function ( t ) {
var anchor = $('.child');
var prev = $('.prev');
var prevprev = $('.prevprev');
var prevs = anchor.prevAll ();
t.deepEqual ( prevs.length, 2 );
t.deepEqual ( prevs[0], prev[0] );
t.deepEqual ( prevs[1], prevprev[0] );
});
});
describe ( '$.fn.siblings', function ( it ) {

@@ -251,4 +323,16 @@

it ( 'supports selector', function ( t ) {
var child = $('.child');
var siblings = $('.sibling').not ( child );
var surrounding = $('.prev, .next');
t.deepEqual ( child.siblings ( '.prev, .next' ), surrounding );
t.deepEqual ( child.siblings ( '*' ), child.siblings () );
t.deepEqual ( child.siblings ( 'foo' ).length, 0 );
});
});
});

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