Socket
Socket
Sign inDemoInstall

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 4.0.0 to 4.1.0

8

CHANGELOG.md

@@ -0,1 +1,9 @@

### Version 4.1.0
- Added $.isWindow
- Made the TypeScript type system stricter
- $.guid: ensuring it’s properly exported
- $.fn.siblings: ensuring it supports multi-element collections
- $.fn.empty: ensuring it supports multi-element collections
- $.fn.attr: doing nothing when the value equals undefined
### Version 4.0.0

@@ -2,0 +10,0 @@ - Removed `$.fn.removeData`

61

dist/cash.d.ts
interface Cash {
[index: number]: Window & Document & HTMLElement & Element & Node;
[index: number]: Ele;
length: number;
splice(start: number, deleteCount?: number): any;
splice(start: number, deleteCount: number, ...items: Ele[]): any;
splice(start: number, deleteCount?: number): Ele[];
splice(start: number, deleteCount: number, ...items: Ele[]): Ele[];
}

@@ -15,5 +15,14 @@ interface CashStatic {

declare type Ele = Window | Document | HTMLElement | Element | Node;
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<any> | Cash;
declare type Comparator = string | Function | Ele | Cash;
declare type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
declare type Comparator = string | Ele | Cash | ((this: Ele, index: number, ele: Ele) => boolean);
declare type Context = Document | HTMLElement | Element;
declare type EventObj = Event & {
__delegate?: boolean;
namespace?: string;
data?: any;
};
declare type EventCallback = {
(event: EventObj, data?: any): any;
guid?: number;
};
declare class Cash {

@@ -37,4 +46,5 @@ constructor(selector?: Selector, context?: Context | Cash);

}
declare type MapCallback<T> = (this: T, index: number, ele: T) => Ele;
interface Cash {
map(callback: Function): Cash;
map(callback: MapCallback<Ele>): Cash;
}

@@ -47,7 +57,8 @@ interface Cash {

}
declare type EachCallback<T> = (this: T, index: number, ele: T) => any;
interface CashStatic {
each(arr: ArrayLike<any>, callback: Function): void;
each<T>(arr: ArrayLike<T>, callback: EachCallback<T>): void;
}
interface Cash {
each(callback: Function): this;
each(callback: EachCallback<Ele>): this;
}

@@ -67,5 +78,6 @@ interface Cash {

interface CashStatic {
matches(ele: HTMLElement, selector: string): boolean;
matches(ele: any, selector: string): boolean;
}
interface CashStatic {
isWindow(x: any): x is Window;
isFunction(x: any): x is Function;

@@ -91,4 +103,5 @@ isString(x: any): x is string;

interface Cash {
attr(attrs: string): any;
attr(attrs: string, value: any): this;
attr(): undefined;
attr(attrs: string): string | null;
attr(attrs: string, value: string): this;
attr(attrs: plainObject): this;

@@ -106,3 +119,3 @@ }

interface CashStatic {
unique(arr: ArrayLike<any>): ArrayLike<any>;
unique<T>(arr: ArrayLike<T>): ArrayLike<T>;
}

@@ -116,4 +129,4 @@ interface Cash {

interface Cash {
css(prop: string): any;
css(prop: string, value: any): this;
css(prop: string): string | undefined;
css(prop: string, value: string): this;
css(props: plainObject): this;

@@ -128,4 +141,4 @@ }

interface Cash {
innerWidth(): number;
innerHeight(): number;
innerWidth(): number | undefined;
innerHeight(): number | undefined;
}

@@ -154,14 +167,14 @@ interface Cash {

off(events: string): this;
off(events: string, callback: Function): this;
off(events: string, selector: string, callback: Function): this;
off(events: string, callback: EventCallback): this;
off(events: string, selector: string, callback: EventCallback): this;
}
interface Cash {
on(events: plainObject): this;
on(events: string, callback: Function, _one?: boolean): this;
on(events: string, selector: string | Function, callback: Function, _one?: boolean): this;
on(events: string, callback: EventCallback, _one?: boolean): this;
on(events: string, selector: string | EventCallback, callback: EventCallback, _one?: boolean): this;
}
interface Cash {
one(events: plainObject): this;
one(events: string, callback: Function): this;
one(events: string, selector: string | Function, callback: Function): this;
one(events: string, callback: EventCallback): this;
one(events: string, selector: string | EventCallback, callback: EventCallback): this;
}

@@ -172,3 +185,3 @@ interface Cash {

interface Cash {
trigger(event: string | Event, data?: any): this;
trigger(event: Event | string, data?: any): this;
}

@@ -180,3 +193,3 @@ interface Cash {

val(): string | string[];
val(value: any): this;
val(value: string | string[]): this;
}

@@ -183,0 +196,0 @@ interface Cash {

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

function find(selector, context = doc) {
return context !== doc && context.nodeType !== 1 && context.nodeType !== 9
return !isDocument(context) && !isElement(context)
? []

@@ -51,3 +51,3 @@ : classRe.test(selector)

Cash.prototype.length = 0;
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome's devtools
if (typeof Symbol === 'function') {

@@ -78,3 +78,3 @@ Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];

const dashAlphaRe = /-([a-z])/g;
function camelCaseReplace(all, letter) {
function camelCaseReplace(match, letter) {
return letter.toUpperCase();

@@ -86,3 +86,2 @@ }

cash.camelCase = camelCase;
// @require ./cash.ts
function each(arr, callback) {

@@ -104,5 +103,5 @@ for (let i = 0, l = arr.length; i < l; i++) {

function extend(target, ...objs) {
let args = arguments, length = args.length;
const args = arguments, length = args.length;
for (let i = (length < 2 ? 0 : 1); i < length; i++) {
for (let key in args[i]) {
for (const key in args[i]) {
target[key] = args[i][key];

@@ -117,8 +116,6 @@ }

cash.extend = extend;
cash.guid = 1;
// @require ./cash.ts
let guid = 1;
cash.guid = guid;
// @require ./cash.ts
function matches(ele, selector) {
const matches = ele && (ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector']);
const matches = ele && (ele['matches'] || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector']);
return !!matches && matches.call(ele, selector);

@@ -145,2 +142,11 @@ }

}
function isWindow(x) {
return !!x && x === x.window;
}
function isDocument(x) {
return !!x && x.nodeType === 9;
}
function isElement(x) {
return !!x && x.nodeType === 1;
}
function isFunction(x) {

@@ -156,2 +162,3 @@ return typeof x === 'function';

const { isArray } = Array;
cash.isWindow = isWindow;
cash.isFunction = isFunction;

@@ -169,3 +176,3 @@ cash.isString = isString;

}
for (let key in prop) {
for (const key in prop) {
this.prop(key, prop[key]);

@@ -202,3 +209,3 @@ }

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

@@ -225,2 +232,4 @@ Cash.prototype.removeAttr = function (attr) {

}
if (value === undefined)
return this;
if (value === null)

@@ -230,3 +239,3 @@ return this.removeAttr(attr);

}
for (let key in attr) {
for (const key in attr) {
this.attr(key, attr[key]);

@@ -275,5 +284,6 @@ }

};
// @require core/type_checking.ts
// @require core/variables.ts
function computeStyle(ele, prop, isVariable) {
if (ele.nodeType !== 1 || !prop)
if (!isElement(ele) || !prop)
return;

@@ -342,6 +352,6 @@ const style = win.getComputedStyle(ele, null);

return this.each((i, ele) => {
if (ele.nodeType !== 1)
if (!isElement(ele))
return;
if (isVariable) {
ele.style.setProperty(prop, value);
ele.style.setProperty(prop, value); //TSC
}

@@ -353,3 +363,3 @@ else {

}
for (let key in prop) {
for (const key in prop) {
this.css(key, prop[key]);

@@ -403,3 +413,3 @@ }

}
for (let key in name) {
for (const key in name) {
this.data(key, name[key]);

@@ -419,3 +429,3 @@ }

return;
if (this[0] === win)
if (isWindow(this[0]))
return win[`inner${prop}`];

@@ -430,9 +440,9 @@ return this[0][`client${prop}`];

if (!arguments.length) {
if (this[0] === win)
if (isWindow(this[0]))
return this[0][camelCase(`outer-${prop}`)];
return this[0].getBoundingClientRect()[prop] - getExtraSpace(this[0], !index);
}
const valueNumber = parseInt(value, 10);
const valueNumber = parseInt(value, 10); //TSC
return this.each((i, ele) => {
if (ele.nodeType !== 1)
if (!isElement(ele))
return;

@@ -448,3 +458,3 @@ const boxSizing = computeStyle(ele, 'boxSizing');

return;
if (this[0] === win)
if (isWindow(this[0]))
return win[`outer${prop}`];

@@ -496,3 +506,3 @@ return this[0][`offset${prop}`] + (includeMargins ? computeStyleInt(this[0], `margin${!index ? 'Left' : 'Top'}`) + computeStyleInt(this[0], `margin${!index ? 'Right' : 'Bottom'}`) : 0);

function hasNamespaces(ns1, ns2) {
return !ns2 || !some.call(ns2, ns => ns1.indexOf(ns) < 0);
return !ns2 || !some.call(ns2, (ns) => ns1.indexOf(ns) < 0);
}

@@ -511,7 +521,7 @@ const eventsNamespace = '__cashEvents', eventsNamespacesSeparator = '.', eventsFocus = { focus: 'focusin', blur: 'focusout' }, eventsHover = { mouseenter: 'mouseover', mouseleave: 'mouseout' }, eventsMouseRe = /^(?:mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;

function addEvent(ele, name, namespaces, selector, callback) {
callback['guid'] = (callback['guid'] || guid++);
callback.guid = callback.guid || cash.guid++;
const eventCache = getEventsCache(ele);
eventCache[name] = (eventCache[name] || []);
eventCache[name].push([namespaces, selector, callback]);
ele.addEventListener(name, callback); //TSC
ele.addEventListener(name, callback);
}

@@ -536,3 +546,3 @@ // @require ./variables.ts

cache[name] = cache[name].filter(([ns, sel, cb]) => {
if ((callback && cb['guid'] !== callback['guid']) || !hasNamespaces(ns, namespaces) || (selector && selector !== sel))
if ((callback && cb.guid !== callback.guid) || !hasNamespaces(ns, namespaces) || (selector && selector !== sel))
return true;

@@ -561,3 +571,3 @@ ele.removeEventListener(name, cb);

if (!isString(eventFullName)) {
for (let key in eventFullName) {
for (const key in eventFullName) {
this.on(key, selector, eventFullName[key]);

@@ -583,3 +593,3 @@ }

return;
target = target.parentNode;
target = target['parentNode'];
if (!target)

@@ -608,3 +618,3 @@ return;

};
finalCallback['guid'] = callback['guid'] = (callback['guid'] || guid++);
finalCallback.guid = callback['guid'] = (callback['guid'] || cash.guid++); //TSC
addEvent(ele, name, namespaces, selector, finalCallback); //TSC

@@ -632,3 +642,3 @@ });

Cash.prototype.trigger = function (eventFullName, data) {
let evt = eventFullName;
let evt;
if (isString(eventFullName)) {

@@ -638,9 +648,12 @@ const [name, namespaces] = parseEventName(eventFullName), type = eventsMouseRe.test(name) ? 'MouseEvents' : 'HTMLEvents';

evt.initEvent(name, true, true);
evt['namespace'] = namespaces.join(eventsNamespacesSeparator);
evt.namespace = namespaces.join(eventsNamespacesSeparator);
}
evt['data'] = data;
const isEventFocus = (evt['type'] in eventsFocus);
else {
evt = eventFullName;
}
evt.data = data;
const isEventFocus = (evt.type in eventsFocus);
return this.each((i, ele) => {
if (isEventFocus && isFunction(ele[evt['type']])) {
ele[evt['type']]();
if (isEventFocus && isFunction(ele[evt.type])) {
ele[evt.type]();
}

@@ -750,9 +763,7 @@ else {

Cash.prototype.empty = function () {
const ele = this[0];
if (ele) {
return this.each((i, ele) => {
while (ele.firstChild) {
ele.removeChild(ele.firstChild);
}
}
return this;
});
};

@@ -808,8 +819,10 @@ function html(html) {

Cash.prototype.children = function (comparator) {
let result = [];
this.each((i, ele) => { push.apply(result, ele.children); });
const result = [];
this.each((i, ele) => {
push.apply(result, ele.children);
});
return filtered(cash(unique(result)), comparator);
};
Cash.prototype.contents = function () {
let result = [];
const result = [];
this.each((i, ele) => {

@@ -831,3 +844,2 @@ push.apply(result, ele.tagName === 'IFRAME' ? [ele.contentDocument] : ele.childNodes);

// @require collection/filter.ts
// @require collection/filter.ts
// @require traversal/find.ts

@@ -1003,4 +1015,7 @@ const scriptTypeRe = /^$|^module$|\/(?:java|ecma)script/i, HTMLCDATARe = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;

Cash.prototype.siblings = function (comparator) {
const ele = this[0];
return filtered(this.parent().children().filter((i, child) => child !== ele), comparator);
const result = [];
this.each((i, ele) => {
push.apply(result, cash(ele).parent().children((ci, child) => child !== ele));
});
return filtered(cash(unique(result)), comparator);
};

@@ -1007,0 +1022,0 @@ // @optional ./children.ts

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

return context !== doc && context.nodeType !== 1 && context.nodeType !== 9 ? [] : classRe.test(selector) ? context.getElementsByClassName(selector.slice(1)) : tagRe.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector);
return !isDocument(context) && !isElement(context) ? [] : classRe.test(selector) ? context.getElementsByClassName(selector.slice(1)) : tagRe.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector);
} // @require ./find.ts

@@ -72,3 +72,3 @@ // @require ./variables.ts

Cash.prototype.length = 0;
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome's devtools

@@ -109,3 +109,3 @@ if (typeof Symbol === 'function') {

function camelCaseReplace(all, letter) {
function camelCaseReplace(match, letter) {
return letter.toUpperCase();

@@ -118,3 +118,3 @@ }

cash.camelCase = camelCase; // @require ./cash.ts
cash.camelCase = camelCase;

@@ -164,9 +164,7 @@ function each(arr, callback) {

cash.extend = extend; // @require ./cash.ts
cash.extend = extend;
cash.guid = 1; // @require ./cash.ts
var guid = 1;
cash.guid = guid; // @require ./cash.ts
function matches(ele, selector) {
var matches = ele && (ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector']);
var matches = ele && (ele['matches'] || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector']);
return !!matches && matches.call(ele, selector);

@@ -198,2 +196,14 @@ }

function isWindow(x) {
return !!x && x === x.window;
}
function isDocument(x) {
return !!x && x.nodeType === 9;
}
function isElement(x) {
return !!x && x.nodeType === 1;
}
function isFunction(x) {

@@ -212,2 +222,3 @@ return typeof x === 'function';

var isArray = Array.isArray;
cash.isWindow = isWindow;
cash.isFunction = isFunction;

@@ -293,2 +304,3 @@ cash.isString = isString;

if (value === undefined) return this;
if (value === null) return this.removeAttr(attr);

@@ -352,7 +364,8 @@ return this.each(function (i, ele) {

return cash(unique(this.get().concat(cash(selector, context).get())));
}; // @require core/variables.ts
}; // @require core/type_checking.ts
// @require core/variables.ts
function computeStyle(ele, prop, isVariable) {
if (ele.nodeType !== 1 || !prop) return;
if (!isElement(ele) || !prop) return;
var style = win.getComputedStyle(ele, null);

@@ -438,6 +451,6 @@ return prop ? isVariable ? style.getPropertyValue(prop) || undefined : style[prop] : style;

return this.each(function (i, ele) {
if (ele.nodeType !== 1) return;
if (!isElement(ele)) return;
if (isVariable_1) {
ele.style.setProperty(prop, value);
ele.style.setProperty(prop, value); //TSC
} else {

@@ -523,3 +536,3 @@ ele.style[prop] = value; //TSC

if (!this[0]) return;
if (this[0] === win) return win["inner" + prop];
if (isWindow(this[0])) return win["inner" + prop];
return this[0]["client" + prop];

@@ -533,9 +546,10 @@ };

if (!arguments.length) {
if (this[0] === win) return this[0][camelCase("outer-" + prop)];
if (isWindow(this[0])) return this[0][camelCase("outer-" + prop)];
return this[0].getBoundingClientRect()[prop] - getExtraSpace(this[0], !index);
}
var valueNumber = parseInt(value, 10);
var valueNumber = parseInt(value, 10); //TSC
return this.each(function (i, ele) {
if (ele.nodeType !== 1) return;
if (!isElement(ele)) return;
var boxSizing = computeStyle(ele, 'boxSizing');

@@ -549,3 +563,3 @@ ele.style[prop] = getSuffixedValue(prop, valueNumber + (boxSizing === 'border-box' ? getExtraSpace(ele, !index) : 0));

if (!this[0]) return;
if (this[0] === win) return win["outer" + prop];
if (isWindow(this[0])) return win["outer" + prop];
return this[0]["offset" + prop] + (includeMargins ? computeStyleInt(this[0], "margin" + (!index ? 'Left' : 'Top')) + computeStyleInt(this[0], "margin" + (!index ? 'Right' : 'Bottom')) : 0);

@@ -631,7 +645,7 @@ };

function addEvent(ele, name, namespaces, selector, callback) {
callback['guid'] = callback['guid'] || guid++;
callback.guid = callback.guid || cash.guid++;
var eventCache = getEventsCache(ele);
eventCache[name] = eventCache[name] || [];
eventCache[name].push([namespaces, selector, callback]);
ele.addEventListener(name, callback); //TSC
ele.addEventListener(name, callback);
} // @require ./variables.ts

@@ -662,3 +676,3 @@

cb = _a[2];
if (callback && cb['guid'] !== callback['guid'] || !hasNamespaces(ns, namespaces) || selector && selector !== sel) return true;
if (callback && cb.guid !== callback.guid || !hasNamespaces(ns, namespaces) || selector && selector !== sel) return true;
ele.removeEventListener(name, cb);

@@ -729,3 +743,3 @@ });

if (target === ele) return;
target = target.parentNode;
target = target['parentNode'];
if (!target) return;

@@ -759,3 +773,4 @@ }

finalCallback['guid'] = callback['guid'] = callback['guid'] || guid++;
finalCallback.guid = callback['guid'] = callback['guid'] || cash.guid++; //TSC
addEvent(ele, name, namespaces, selector, finalCallback); //TSC

@@ -791,3 +806,3 @@ });

Cash.prototype.trigger = function (eventFullName, data) {
var evt = eventFullName;
var evt;

@@ -802,10 +817,12 @@ if (isString(eventFullName)) {

evt.initEvent(name_1, true, true);
evt['namespace'] = namespaces.join(eventsNamespacesSeparator);
evt.namespace = namespaces.join(eventsNamespacesSeparator);
} else {
evt = eventFullName;
}
evt['data'] = data;
var isEventFocus = evt['type'] in eventsFocus;
evt.data = data;
var isEventFocus = evt.type in eventsFocus;
return this.each(function (i, ele) {
if (isEventFocus && isFunction(ele[evt['type']])) {
ele[evt['type']]();
if (isEventFocus && isFunction(ele[evt.type])) {
ele[evt.type]();
} else {

@@ -928,11 +945,7 @@ ele.dispatchEvent(evt);

Cash.prototype.empty = function () {
var ele = this[0];
if (ele) {
return this.each(function (i, ele) {
while (ele.firstChild) {
ele.removeChild(ele.firstChild);
}
}
return this;
});
};

@@ -1027,3 +1040,2 @@

}; // @require collection/filter.ts
// @require collection/filter.ts
// @require traversal/find.ts

@@ -1252,6 +1264,9 @@

Cash.prototype.siblings = function (comparator) {
var ele = this[0];
return filtered(this.parent().children().filter(function (i, child) {
return child !== ele;
}), comparator);
var result = [];
this.each(function (i, ele) {
push.apply(result, cash(ele).parent().children(function (ci, child) {
return child !== ele;
}));
});
return filtered(cash(unique(result)), comparator);
}; // @optional ./children.ts

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

@@ -17,7 +17,18 @@

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 Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
type Comparator = string | Ele | Cash | (( this: Ele, index: number, ele: Ele ) => boolean);
type Context = Document | HTMLElement | Element;
type EventObj = Event & {
__delegate?: boolean,
namespace?: string,
data?: any
};
type EventCallback = {
( event: EventObj, data?: any ): any,
guid?: number
};
const doc = document,

@@ -36,5 +47,5 @@ win = window,

function find ( selector: string, context: Context = doc ) {
function find ( selector: string, context: Ele = doc ): ArrayLike<Element> {
return context !== doc && context.nodeType !== 1 && context.nodeType !== 9
return !isDocument ( context ) && !isElement ( context )
? []

@@ -106,3 +117,3 @@ : classRe.test ( selector )

Cash.prototype.length = 0;
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome's devtools

@@ -170,8 +181,10 @@ if ( typeof Symbol === 'function' ) {

type MapCallback<T> = ( this: T, index: number, ele: T ) => Ele;
interface Cash {
map ( callback: Function ): Cash;
map ( callback: MapCallback<Ele> ): Cash;
}
Cash.prototype.map = function ( this: Cash, callback: Function ) {
return cash ( map.call ( this, ( ele, i ) => callback.call ( ele, i, ele ) ) );
Cash.prototype.map = function ( this: Cash, callback: MapCallback<Ele> ) {
return cash ( map.call ( this, ( ele: Ele, i: number ) => callback.call ( ele, i, ele ) ) );
};

@@ -196,7 +209,7 @@

function camelCaseReplace ( all, letter ) {
function camelCaseReplace ( match: string, letter: string ): string {
return letter.toUpperCase ();
}
function camelCase ( str: string ) {
function camelCase ( str: string ): string {
return str.replace ( dashAlphaRe, camelCaseReplace );

@@ -214,4 +227,6 @@ }

function each ( arr: ArrayLike<any>, callback: Function ): void {
type EachCallback<T> = ( this: T, index: number, ele: T ) => any;
function each<T> ( arr: ArrayLike<T>, callback: EachCallback<T> ): void {
for ( let i = 0, l = arr.length; i < l; i++ ) {

@@ -226,3 +241,3 @@

interface CashStatic {
each ( arr: ArrayLike<any>, callback: Function ): void;
each<T> ( arr: ArrayLike<T>, callback: EachCallback<T> ): void;
}

@@ -237,6 +252,6 @@

interface Cash {
each ( callback: Function ): this;
each ( callback: EachCallback<Ele> ): this;
}
Cash.prototype.each = function ( this: Cash, callback: Function ) {
Cash.prototype.each = function ( this: Cash, callback: EachCallback<Ele> ) {
each ( this, callback );

@@ -261,9 +276,9 @@ return this;

function extend ( target, ...objs: any[] ) {
function extend ( target: any, ...objs: any[] ) {
let args = arguments,
length = args.length;
const args = arguments,
length = args.length;
for ( let i = ( length < 2 ? 0 : 1 ); i < length; i++ ) {
for ( let key in args[i] ) {
for ( const key in args[i] ) {
target[key] = args[i][key];

@@ -286,3 +301,3 @@ }

interface CashStatic {
extend ( target, ...objs: any[] );
extend ( target: any, ...objs: any[] ): any;
}

@@ -295,4 +310,2 @@

let guid = 1;
interface CashStatic {

@@ -302,3 +315,3 @@ guid: number;

cash.guid = guid;
cash.guid = 1;

@@ -308,5 +321,5 @@

function matches ( ele: HTMLElement, selector: string ): boolean {
function matches ( ele: any, selector: string ): boolean {
const matches = ele && ( ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector'] );
const matches = ele && ( ele['matches'] || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector'] );

@@ -318,3 +331,3 @@ return !!matches && matches.call ( ele, selector );

interface CashStatic {
matches ( ele: HTMLElement, selector: string ): boolean;
matches ( ele: any, selector: string ): boolean;
}

@@ -327,5 +340,5 @@

function pluck ( arr: ArrayLike<any>, prop: string, deep?: boolean ): ArrayLike<any> {
function pluck<T> ( arr: ArrayLike<T>, prop: string, deep?: boolean ): Array<T> {
const plucked = [];
const plucked: Array<T> = [];

@@ -355,15 +368,27 @@ for ( let i = 0, l = arr.length; i < l; i++ ) {

function isCash ( x ): x is Cash {
function isCash ( x: any ): x is Cash {
return x instanceof Cash;
}
function isFunction ( x ): x is Function {
function isWindow ( x: any ): x is Window {
return !!x && x === x.window;
}
function isDocument ( x: any ): x is Document {
return !!x && x.nodeType === 9;
}
function isElement ( x: any ): x is HTMLElement {
return !!x && x.nodeType === 1;
}
function isFunction ( x: any ): x is Function {
return typeof x === 'function';
}
function isString ( x ): x is string {
function isString ( x: any ): x is string {
return typeof x === 'string';
}
function isNumeric ( x ): boolean {
function isNumeric ( x: any ): boolean {
return !isNaN ( parseFloat ( x ) ) && isFinite ( x );

@@ -375,8 +400,10 @@ }

interface CashStatic {
isFunction ( x ): x is Function;
isString ( x ): x is string;
isNumeric ( x ): boolean;
isArray ( x ): x is Array<any>;
isWindow ( x: any ): x is Window;
isFunction ( x: any ): x is Function;
isString ( x: any ): x is string;
isNumeric ( x: any ): boolean;
isArray ( x: any ): x is Array<any>;
}
cash.isWindow = isWindow;
cash.isFunction = isFunction;

@@ -393,8 +420,8 @@ cash.isString = isString;

interface Cash {
prop ( prop: string );
prop ( prop: string, value ): this;
prop ( prop: string ): any;
prop ( prop: string, value: any ): this;
prop ( props: plainObject ): this;
}
Cash.prototype.prop = function ( this: Cash, prop: string | plainObject, value? ) {
Cash.prototype.prop = function ( this: Cash, prop: string | plainObject, value?: any ) {

@@ -411,3 +438,3 @@ if ( !prop ) return;

for ( let key in prop ) {
for ( const key in prop ) {

@@ -429,8 +456,8 @@ this.prop ( key, prop[key] );

return isString ( comparator )
? ( i, ele ) => matches ( ele, comparator )
? ( i: number, ele: Ele ) => matches ( ele, comparator )
: isFunction ( comparator )
? comparator
: isCash ( comparator )
? ( i, ele ) => comparator.is ( ele )
: ( i, ele ) => ele === comparator;
? ( i: number, ele: Ele ) => comparator.is ( ele )
: ( i: number, ele: Ele ) => ele === comparator;

@@ -456,3 +483,3 @@ }

return cash ( filter.call ( this, ( ele, i ) => compare.call ( ele, i, ele ) ) );
return cash ( filter.call ( this, ( ele: Ele, i: number ) => compare.call ( ele, i, ele ) ) );

@@ -487,3 +514,3 @@ };

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

@@ -521,11 +548,13 @@

interface Cash {
attr ( attrs: string );
attr ( attrs: string, value ): this;
attr (): undefined;
attr ( attrs: string ): string | null;
attr ( attrs: string, value: string ): this;
attr ( attrs: plainObject ): this;
}
function attr ( this: Cash, attr: string );
function attr ( this: Cash, attr: string, value ): Cash;
function attr ( this: Cash ): undefined;
function attr ( this: Cash, attr: string ): string | null;
function attr ( this: Cash, attr: string, value: string ): Cash;
function attr ( this: Cash, attr: plainObject ): Cash;
function attr ( this: Cash, attr: string | plainObject, value? ) {
function attr ( this: Cash, attr?: string | plainObject, value?: string ) {

@@ -546,2 +575,4 @@ if ( !attr ) return;

if ( value === undefined ) return this;
if ( value === null ) return this.removeAttr ( attr );

@@ -553,3 +584,3 @@

for ( let key in attr ) {
for ( const key in attr ) {

@@ -617,3 +648,3 @@ this.attr ( key, attr[key] );

Cash.prototype.removeClass = function ( this: Cash, cls?: string ) {
return !arguments.length ? this.attr ( 'class', '' ) : this.toggleClass ( cls as string, false );
return !arguments.length ? this.attr ( 'class', '' ) : this.toggleClass ( cls, false );
};

@@ -635,8 +666,8 @@

function unique ( arr: ArrayLike<any> ): ArrayLike<any> {
return arr.length > 1 ? filter.call ( arr, ( item, index, self ) => indexOf.call ( self, item ) === index ) : arr;
function unique<T> ( arr: ArrayLike<T> ): ArrayLike<T> {
return arr.length > 1 ? filter.call ( arr, ( item: T, index: number, self: ArrayLike<T> ) => indexOf.call ( self, item ) === index ) : arr;
}
interface CashStatic {
unique ( arr: ArrayLike<any> ): ArrayLike<any>;
unique<T> ( arr: ArrayLike<T> ): ArrayLike<T>;
}

@@ -660,7 +691,8 @@

// @require core/type_checking.ts
// @require core/variables.ts
function computeStyle ( ele: HTMLElement, prop: string, isVariable?: boolean ): undefined | string {
function computeStyle ( ele: Ele, prop: string, isVariable?: boolean ): string | undefined {
if ( ele.nodeType !== 1 || !prop ) return;
if ( !isElement ( ele ) || !prop ) return;

@@ -676,3 +708,3 @@ const style = win.getComputedStyle ( ele, null );

function computeStyleInt ( ele: HTMLElement, prop: string ): number {
function computeStyleInt ( ele: Ele, prop: string ): number {

@@ -702,3 +734,3 @@ return parseInt ( computeStyle ( ele, prop ), 10 ) || 0;

const prefixedProps: plainObject = {},
const prefixedProps: { [prop: string]: string } = {},
{style} = div,

@@ -740,3 +772,3 @@ vendorsPrefixes = ['webkit', 'moz', 'ms', 'o'];

const numericProps = {
const numericProps: { [prop: string]: true | undefined } = {
animationIterationCount: true,

@@ -755,3 +787,3 @@ columnCount: true,

function getSuffixedValue ( prop: string, value: number | string, isVariable: boolean = isCSSVariable ( prop ) ): number | string {
function getSuffixedValue ( prop: string, value: string, isVariable: boolean = isCSSVariable ( prop ) ): string {

@@ -772,11 +804,11 @@ return !isVariable && !numericProps[prop] && isNumeric ( value ) ? `${value}px` : value;

interface Cash {
css ( prop: string );
css ( prop: string, value ): this;
css ( prop: string ): string | undefined;
css ( prop: string, value: string ): this;
css ( props: plainObject ): this;
}
function css ( this: Cash, prop: string );
function css ( this: Cash, prop: string, value ): Cash;
function css ( this: Cash, prop: string ): string | undefined;
function css ( this: Cash, prop: string, value: string ): Cash;
function css ( this: Cash, prop: plainObject ): Cash;
function css ( this: Cash, prop: string | plainObject, value? ) {
function css ( this: Cash, prop: string | plainObject, value?: string ) {

@@ -797,7 +829,7 @@ if ( isString ( prop ) ) {

if ( ele.nodeType !== 1 ) return;
if ( !isElement ( ele ) ) return;
if ( isVariable ) {
ele.style.setProperty ( prop, value );
ele.style.setProperty ( prop as string, value ); //TSC

@@ -814,3 +846,3 @@ } else {

for ( let key in prop ) {
for ( const key in prop ) {

@@ -833,3 +865,3 @@ this.css ( key, prop[key] );

function getData ( ele: HTMLElement, key: string ) {
function getData ( ele: Ele, key: string ): any {

@@ -849,3 +881,3 @@ const value = ele.dataset ? ele.dataset[key] || ele.dataset[camelCase ( key )] : ele.getAttribute ( `data-${key}` );

function setData ( ele: HTMLElement, key: string, value ): void {
function setData ( ele: Ele, key: string, value: any ): void {

@@ -881,4 +913,4 @@ try {

data (): plainObject | undefined;
data ( name: string );
data ( name: string, value ): this;
data ( name: string ): any;
data ( name: string, value: any ): this;
data ( datas: plainObject ): this;

@@ -888,6 +920,6 @@ }

function data ( this: Cash ): plainObject | undefined;
function data ( this: Cash, name: string );
function data ( this: Cash, name: string, value ): Cash;
function data ( this: Cash, name: string ): any;
function data ( this: Cash, name: string, value: any ): Cash;
function data ( this: Cash, name: plainObject ): Cash;
function data ( this: Cash, name?: string | plainObject, value? ) {
function data ( this: Cash, name?: string | plainObject, value?: any ) {

@@ -898,3 +930,3 @@ if ( !name ) {

const datas = {};
const datas: { [data: string]: any } = {};

@@ -923,3 +955,3 @@ each ( this[0].attributes, ( i, attr ) => {

for ( let key in name ) {
for ( const key in name ) {

@@ -942,3 +974,3 @@ this.data ( key, name[key] );

function getExtraSpace ( ele: HTMLElement, xAxis?: boolean ): number {
function getExtraSpace ( ele: Element, xAxis?: boolean ): number {
return computeStyleInt ( ele, `border${ xAxis ? 'Left' : 'Top' }Width` ) + computeStyleInt ( ele, `padding${ xAxis ? 'Left' : 'Top' }` ) + computeStyleInt ( ele, `padding${ xAxis ? 'Right' : 'Bottom' }` ) + computeStyleInt ( ele, `border${ xAxis ? 'Right' : 'Bottom' }Width` );

@@ -950,16 +982,17 @@ }

// @require core/each.ts
// @require core/type_checking.ts
// @require core/variables.ts
interface Cash {
innerWidth (): number;
innerHeight (): number;
innerWidth (): number | undefined;
innerHeight (): number | undefined;
}
each ( ['Width', 'Height'], ( i, prop: string ) => {
each ( ['Width', 'Height'], ( i, prop: 'Width' | 'Height' ) => {
Cash.prototype[`inner${prop}`] = function () {
Cash.prototype[`inner${prop}`] = function ( this: Cash ) {
if ( !this[0] ) return;
if ( this[0] === win ) return win[`inner${prop}`];
if ( isWindow ( this[0] ) ) return win[`inner${prop}`];

@@ -976,2 +1009,3 @@ return this[0][`client${prop}`];

// @require core/each.ts
// @require core/type_checking.ts
// @require core/variables.ts

@@ -989,5 +1023,5 @@ // @require css/helpers/compute_style.ts

each ( ['width', 'height'], ( index: number, prop: string ) => {
each ( ['width', 'height'], ( index: number, prop: 'width' | 'height' ) => {
Cash.prototype[prop] = function ( value?: number | string ) {
Cash.prototype[prop] = function ( this: Cash, value?: number | string ) {

@@ -998,3 +1032,3 @@ if ( !this[0] ) return value === undefined ? undefined : this;

if ( this[0] === win ) return this[0][ camelCase ( `outer-${prop}` )];
if ( isWindow ( this[0] ) ) return this[0][ camelCase ( `outer-${prop}` )];

@@ -1005,7 +1039,7 @@ return this[0].getBoundingClientRect ()[prop] - getExtraSpace ( this[0], !index );

const valueNumber = parseInt ( value as string, 10 );
const valueNumber = parseInt ( value as string, 10 ); //TSC
return this.each ( ( i, ele ) => {
if ( ele.nodeType !== 1 ) return;
if ( !isElement ( ele ) ) return;

@@ -1025,2 +1059,3 @@ const boxSizing = computeStyle ( ele, 'boxSizing' );

// @require core/each.ts
// @require core/type_checking.ts
// @require core/variables.ts

@@ -1036,7 +1071,7 @@ // @require css/helpers/compute_style_int.ts

Cash.prototype[`outer${prop}`] = function ( includeMargins?: boolean ) {
Cash.prototype[`outer${prop}`] = function ( this: Cash, includeMargins?: boolean ) {
if ( !this[0] ) return;
if ( this[0] === win ) return win[`outer${prop}`];
if ( isWindow ( this[0] ) ) return win[`outer${prop}`];

@@ -1057,3 +1092,3 @@ return this[0][`offset${prop}`] + ( includeMargins ? computeStyleInt ( this[0], `margin${ !index ? 'Left' : 'Top' }` ) + computeStyleInt ( this[0], `margin${ !index ? 'Right' : 'Bottom' }` ) : 0 );

const defaultDisplay = {};
const defaultDisplay: { [tagName: string]: string } = {};

@@ -1079,3 +1114,3 @@ function getDefaultDisplay ( tagName: string ): string {

function isHidden ( ele: HTMLElement ): boolean {
function isHidden ( ele: Element ): boolean {

@@ -1152,3 +1187,3 @@ return computeStyle ( ele, 'display' ) === 'none';

return !ns2 || !some.call ( ns2, ns => ns1.indexOf ( ns ) < 0 );
return !ns2 || !some.call ( ns2, ( ns: string ) => ns1.indexOf ( ns ) < 0 );

@@ -1160,4 +1195,4 @@ }

eventsNamespacesSeparator = '.',
eventsFocus = { focus: 'focusin', blur: 'focusout' },
eventsHover = { mouseenter: 'mouseover', mouseleave: 'mouseout' },
eventsFocus: { [event: string]: string | undefined } = { focus: 'focusin', blur: 'focusout' },
eventsHover: { [event: string]: string | undefined } = { mouseenter: 'mouseover', mouseleave: 'mouseout' },
eventsMouseRe = /^(?:mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;

@@ -1168,3 +1203,3 @@

function getEventNameBubbling ( name: string ) {
function getEventNameBubbling ( name: string ): string {

@@ -1178,3 +1213,3 @@ return eventsHover[name] || eventsFocus[name] || name;

function getEventsCache ( ele: Ele ): plainObject {
function getEventsCache ( ele: Ele ): { [event: string]: [string[], string, EventCallback][] } {

@@ -1189,5 +1224,5 @@ return ele[eventsNamespace] = ( ele[eventsNamespace] || {} );

function addEvent ( ele: Ele, name: string, namespaces: string[], selector: string, callback: Function ): void {
function addEvent ( ele: Ele, name: string, namespaces: string[], selector: string, callback: EventCallback ): void {
callback['guid'] = ( callback['guid'] || guid++ );
callback.guid = callback.guid || cash.guid++;

@@ -1199,3 +1234,3 @@ const eventCache = getEventsCache ( ele );

ele.addEventListener ( name, callback as EventListener ); //TSC
ele.addEventListener ( name, callback );

@@ -1220,3 +1255,3 @@ }

function removeEvent ( ele: Ele, name?: string, namespaces?: string[], selector?: string, callback?: Function ): void {
function removeEvent ( ele: Ele, name?: string, namespaces?: string[], selector?: string, callback?: EventCallback ): void {

@@ -1239,3 +1274,3 @@ const cache = getEventsCache ( ele );

if ( ( callback && cb['guid'] !== callback['guid'] ) || !hasNamespaces ( ns, namespaces ) || ( selector && selector !== sel ) ) return true;
if ( ( callback && cb.guid !== callback.guid ) || !hasNamespaces ( ns, namespaces ) || ( selector && selector !== sel ) ) return true;

@@ -1262,7 +1297,7 @@ ele.removeEventListener ( name, cb );

off ( events: string ): this;
off ( events: string, callback: Function ): this;
off ( events: string, selector: string, callback: Function ): this;
off ( events: string, callback: EventCallback ): this;
off ( events: string, selector: string, callback: EventCallback ): this;
}
Cash.prototype.off = function ( this: Cash, eventFullName?: string, selector?: string | Function, callback?: Function ) {
Cash.prototype.off = function ( this: Cash, eventFullName?: string, selector?: string | EventCallback, callback?: EventCallback ) {

@@ -1312,14 +1347,14 @@ if ( eventFullName === undefined ) {

on ( events: plainObject ): this;
on ( events: string, callback: Function, _one?: boolean ): this;
on ( events: string, selector: string | Function, callback: Function, _one?: boolean ): this;
on ( events: string, callback: EventCallback, _one?: boolean ): this;
on ( events: string, selector: string | EventCallback, callback: EventCallback, _one?: boolean ): this;
}
function on ( this: Cash, eventFullName: plainObject ): Cash;
function on ( this: Cash, eventFullName: string, callback: Function, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string, selector: string | Function, callback: Function, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string | plainObject, selector?: string | Function, callback?: boolean | Function, _one?: boolean ) {
function on ( this: Cash, eventFullName: string, callback: EventCallback, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string, selector: string | EventCallback, callback: EventCallback, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string | plainObject, selector?: string | EventCallback, callback?: boolean | EventCallback, _one?: boolean ) {
if ( !isString ( eventFullName ) ) {
for ( let key in eventFullName ) {
for ( const key in eventFullName ) {

@@ -1347,7 +1382,7 @@ this.on ( key, selector, eventFullName[key] );

const finalCallback = function ( event ) {
const finalCallback = function ( event: EventObj ) {
if ( event.namespace && !hasNamespaces ( namespaces, event.namespace.split ( eventsNamespacesSeparator ) ) ) return;
let thisArg = ele;
let thisArg: EventTarget = ele;

@@ -1360,3 +1395,3 @@ if ( selector ) {

if ( target === ele ) return;
target = target.parentNode;
target = target['parentNode'];
if ( !target ) return;

@@ -1382,3 +1417,3 @@ }

const returnValue = ( callback as Function ).call ( thisArg, event, event.data ); //TSC
const returnValue = ( callback as EventCallback ).call ( thisArg, event, event.data ); //TSC

@@ -1400,3 +1435,3 @@ if ( _one ) {

finalCallback['guid'] = callback['guid'] = ( callback['guid'] || guid++ );
finalCallback.guid = callback['guid'] = ( callback['guid'] || cash.guid++ ); //TSC

@@ -1421,11 +1456,11 @@ addEvent ( ele, name, namespaces, selector as string, finalCallback ); //TSC

one ( events: plainObject ): this;
one ( events: string, callback: Function ): this;
one ( events: string, selector: string | Function, callback: Function ): this;
one ( events: string, callback: EventCallback ): this;
one ( events: string, selector: string | EventCallback, callback: EventCallback ): this;
}
function one ( this: Cash, eventFullName: plainObject ): Cash;
function one ( this: Cash, eventFullName: string, callback: Function ): Cash;
function one ( this: Cash, eventFullName: string, selector: string | Function, callback: Function ): Cash;
function one ( this: Cash, eventFullName: string | plainObject, selector?: string | Function, callback?: Function ) {
return this.on ( ( eventFullName as string ), selector, callback, true ); //TSC
function one ( this: Cash, eventFullName: string, callback: EventCallback ): Cash;
function one ( this: Cash, eventFullName: string, selector: string | EventCallback, callback: EventCallback ): Cash;
function one ( this: Cash, eventFullName: string | plainObject, selector?: string | EventCallback, callback?: EventCallback ) {
return this.on ( eventFullName as string, selector, callback, true ); //TSC
};

@@ -1470,8 +1505,8 @@

interface Cash {
trigger ( event: string | Event, data? ): this;
trigger ( event: Event | string, data?: any ): this;
}
Cash.prototype.trigger = function ( this: Cash, eventFullName: string | Event, data? ) {
Cash.prototype.trigger = function ( this: Cash, eventFullName: Event | string, data?: any ) {
let evt: string | Event = eventFullName;
let evt: EventObj;

@@ -1485,15 +1520,19 @@ if ( isString ( eventFullName ) ) {

evt.initEvent ( name, true, true );
evt['namespace'] = namespaces.join ( eventsNamespacesSeparator );
evt.namespace = namespaces.join ( eventsNamespacesSeparator );
} else {
evt = eventFullName;
}
evt['data'] = data;
evt.data = data;
const isEventFocus = ( evt['type'] in eventsFocus );
const isEventFocus = ( evt.type in eventsFocus );
return this.each ( ( i, ele ) => {
if ( isEventFocus && isFunction ( ele[evt['type']] ) ) {
if ( isEventFocus && isFunction ( ele[evt.type] ) ) {
ele[evt['type']]();
ele[evt.type]();

@@ -1521,5 +1560,5 @@ } else {

function getValue ( ele ): string | string[] {
function getValue ( ele: Ele ): string | string[] {
if ( ele.multiple ) return pluck ( filter.call ( ele.options, option => option.selected && !option.disabled && !option.parentNode.disabled ), 'value' ) as string[];
if ( ele.multiple ) return pluck ( filter.call ( ele.options, option => option.selected && !option.disabled && !option.parentNode.disabled ), 'value' );

@@ -1590,3 +1629,3 @@ return ele.value || '';

val (): string | string[];
val ( value ): this;
val ( value: string | string[] ): this;
}

@@ -1734,6 +1773,4 @@

const ele = this[0];
return this.each ( ( i, ele ) => {
if ( ele ) {
while ( ele.firstChild ) {

@@ -1745,6 +1782,4 @@

}
});
return this;
};

@@ -1901,3 +1936,2 @@

// @require collection/each.ts
// @require collection/filter.ts

@@ -1910,6 +1944,10 @@ interface Cash {

let result: Ele[] | Cash = [];
const result: Ele[] = [];
this.each ( ( i, ele ) => { push.apply ( result, ele.children ) } );
this.each ( ( i, ele ) => {
push.apply ( result, ele.children );
});
return filtered ( cash ( unique ( result ) ), comparator );

@@ -1930,3 +1968,3 @@

let result: Ele[] = [];
const result: Ele[] = [];

@@ -1970,3 +2008,2 @@ this.each ( ( i, ele ) => {

// @require collection/filter.ts
// @require collection/filter.ts
// @require traversal/find.ts

@@ -1977,7 +2014,7 @@

function evalScripts ( node: Node ) {
function evalScripts ( node: Node ): void {
const collection = cash ( node );
collection.filter ( 'script' ).add ( collection.find ( 'script' ) ).each ( ( i, ele ) => {
collection.filter ( 'script' ).add ( collection.find ( 'script' ) ).each ( ( i, ele: HTMLScriptElement ) => {
if ( !ele.src && scriptTypeRe.test ( ele.type ) ) { // The script type is supported

@@ -1995,3 +2032,3 @@ if ( ele.ownerDocument.documentElement.contains ( ele ) ) { // The element is attached to the DOM // Using `documentElement` for broader browser support

function insertElement ( anchor: Node, child: Node, prepend?: boolean, prependTarget?: Node ): void {
function insertElement ( anchor: Ele, child: Ele, prepend?: boolean, prependTarget?: Element ): void {

@@ -2019,4 +2056,4 @@ if ( prepend ) {

each ( parent, ( index: number, parentEle: HTMLElement ) => {
each ( child, ( i, childEle: HTMLElement ) => {
each ( parent, ( index: number, parentEle: Ele ) => {
each ( child, ( i, childEle: Ele ) => {
insertElement ( parentEle, !index ? childEle : childEle.cloneNode ( true ), prepend, prepend && parentEle.firstChild );

@@ -2068,3 +2105,3 @@ });

cash ( selector ).each ( ( index: number, ele: HTMLElement ) => {
cash ( selector ).each ( ( index: number, ele: Ele ) => {

@@ -2114,3 +2151,3 @@ const parent = ele.parentNode;

cash ( selector ).each ( ( index: number, ele: HTMLElement ) => {
cash ( selector ).each ( ( index: number, ele: Ele ) => {

@@ -2221,3 +2258,3 @@ const parent = ele.parentNode;

let wrapper = structure[0] as Element;
let wrapper = structure[0];

@@ -2312,4 +2349,4 @@ while ( wrapper.children.length ) wrapper = wrapper.firstElementChild;

const comparator = isString ( selector )
? ( i, ele ) => !!find ( selector, ele ).length
: ( i, ele ) => ele.contains ( selector );
? ( i: number, ele: Ele ) => !!find ( selector, ele ).length
: ( i: number, ele: Ele ) => ele.contains ( selector );

@@ -2514,3 +2551,5 @@ return this.filter ( comparator );

// @require core/filtered.ts
// @require collection/filter.ts
// @require core/unique.ts
// @require core/variables.ts
// @require collection/each.ts
// @require ./children.ts

@@ -2525,6 +2564,12 @@ // @require ./parent.ts

const ele = this[0];
const result: Ele[] = [];
return filtered ( this.parent ().children ().filter ( ( i, child ) => child !== ele ), comparator );
this.each ( ( i, ele ) => {
push.apply ( result, cash ( ele ).parent ().children ( ( ci, child ) => child !== ele ) );
});
return filtered ( cash ( unique ( result ) ), comparator );
};

@@ -2531,0 +2576,0 @@

{
"name": "cash-dom",
"description": "An absurdly small jQuery alternative for modern browsers.",
"version": "4.0.0",
"version": "4.1.0",
"license": "MIT",

@@ -39,5 +39,3 @@ "main": "./dist/cash.js",

},
"dependencies": {
"@types/node": "^10.12.8"
},
"dependencies": {},
"devDependencies": {

@@ -44,0 +42,0 @@ "browser-sync": "^2.26.3",

@@ -33,6 +33,6 @@

Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.0.0/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@4.0.0/dist/cash.min.js) and use it like this:
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.0/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@4.1.0/dist/cash.min.js) and use it like this:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.0.0/cash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.0/cash.min.js"></script>
<script>

@@ -827,3 +827,3 @@ $(function () {

| [$.isString ()](#isstring-) | [$.extend ()](#extend-) |
| | [$.matches ()](#matches-) |
| [$.isWindow ()](#iswindow-) | [$.matches ()](#matches-) |
| | [$.parseHTML ()](#parsehtml-) |

@@ -898,2 +898,10 @@ | | [$.prefixedProp ()](#prefixedprop-) |

#### $.isWindow ()
Check if the argument is a Window object.
```js
$.isWindow ( window ) // => true
```
#### $.matches ()

@@ -900,0 +908,0 @@

@@ -8,11 +8,13 @@

interface Cash {
attr ( attrs: string );
attr ( attrs: string, value ): this;
attr (): undefined;
attr ( attrs: string ): string | null;
attr ( attrs: string, value: string ): this;
attr ( attrs: plainObject ): this;
}
function attr ( this: Cash, attr: string );
function attr ( this: Cash, attr: string, value ): Cash;
function attr ( this: Cash ): undefined;
function attr ( this: Cash, attr: string ): string | null;
function attr ( this: Cash, attr: string, value: string ): Cash;
function attr ( this: Cash, attr: plainObject ): Cash;
function attr ( this: Cash, attr: string | plainObject, value? ) {
function attr ( this: Cash, attr?: string | plainObject, value?: string ) {

@@ -33,2 +35,4 @@ if ( !attr ) return;

if ( value === undefined ) return this;
if ( value === null ) return this.removeAttr ( attr );

@@ -40,3 +44,3 @@

for ( let key in attr ) {
for ( const key in attr ) {

@@ -43,0 +47,0 @@ this.attr ( key, attr[key] );

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

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

@@ -7,8 +7,8 @@

interface Cash {
prop ( prop: string );
prop ( prop: string, value ): this;
prop ( prop: string ): any;
prop ( prop: string, value: any ): this;
prop ( props: plainObject ): this;
}
Cash.prototype.prop = function ( this: Cash, prop: string | plainObject, value? ) {
Cash.prototype.prop = function ( this: Cash, prop: string | plainObject, value?: any ) {

@@ -25,3 +25,3 @@ if ( !prop ) return;

for ( let key in prop ) {
for ( const key in prop ) {

@@ -28,0 +28,0 @@ this.prop ( key, prop[key] );

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

Cash.prototype.removeClass = function ( this: Cash, cls?: string ) {
return !arguments.length ? this.attr ( 'class', '' ) : this.toggleClass ( cls as string, false );
return !arguments.length ? this.attr ( 'class', '' ) : this.toggleClass ( cls, false );
};

@@ -6,8 +6,8 @@

interface Cash {
each ( callback: Function ): this;
each ( callback: EachCallback<Ele> ): this;
}
Cash.prototype.each = function ( this: Cash, callback: Function ) {
Cash.prototype.each = function ( this: Cash, callback: EachCallback<Ele> ) {
each ( this, callback );
return this;
};

@@ -18,4 +18,4 @@

return cash ( filter.call ( this, ( ele, i ) => compare.call ( ele, i, ele ) ) );
return cash ( filter.call ( this, ( ele: Ele, i: number ) => compare.call ( ele, i, ele ) ) );
};

@@ -5,8 +5,10 @@

type MapCallback<T> = ( this: T, index: number, ele: T ) => Ele;
interface Cash {
map ( callback: Function ): Cash;
map ( callback: MapCallback<Ele> ): Cash;
}
Cash.prototype.map = function ( this: Cash, callback: Function ) {
return cash ( map.call ( this, ( ele, i ) => callback.call ( ele, i, ele ) ) );
Cash.prototype.map = function ( this: Cash, callback: MapCallback<Ele> ) {
return cash ( map.call ( this, ( ele: Ele, i: number ) => callback.call ( ele, i, ele ) ) );
};

@@ -6,7 +6,7 @@

function camelCaseReplace ( all, letter ) {
function camelCaseReplace ( match: string, letter: string ): string {
return letter.toUpperCase ();
}
function camelCase ( str: string ) {
function camelCase ( str: string ): string {
return str.replace ( dashAlphaRe, camelCaseReplace );

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

@@ -58,3 +58,3 @@

Cash.prototype.length = 0;
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome's devtools

@@ -61,0 +61,0 @@ if ( typeof Symbol === 'function' ) {

// @require ./cash.ts
function each ( arr: ArrayLike<any>, callback: Function ): void {
type EachCallback<T> = ( this: T, index: number, ele: T ) => any;
function each<T> ( arr: ArrayLike<T>, callback: EachCallback<T> ): void {
for ( let i = 0, l = arr.length; i < l; i++ ) {

@@ -15,5 +17,5 @@

interface CashStatic {
each ( arr: ArrayLike<any>, callback: Function ): void;
each<T> ( arr: ArrayLike<T>, callback: EachCallback<T> ): void;
}
cash.each = each;
// @require ./cash.ts
function extend ( target, ...objs: any[] ) {
function extend ( target: any, ...objs: any[] ) {
let args = arguments,
length = args.length;
const args = arguments,
length = args.length;
for ( let i = ( length < 2 ? 0 : 1 ); i < length; i++ ) {
for ( let key in args[i] ) {
for ( const key in args[i] ) {
target[key] = args[i][key];

@@ -28,5 +28,5 @@ }

interface CashStatic {
extend ( target, ...objs: any[] );
extend ( target: any, ...objs: any[] ): any;
}
cash.extend = extend;
// @require ./variables.ts
function find ( selector: string, context: Context = doc ) {
function find ( selector: string, context: Ele = doc ): ArrayLike<Element> {
return context !== doc && context.nodeType !== 1 && context.nodeType !== 9
return !isDocument ( context ) && !isElement ( context )
? []

@@ -8,0 +8,0 @@ : classRe.test ( selector )

@@ -8,9 +8,9 @@

return isString ( comparator )
? ( i, ele ) => matches ( ele, comparator )
? ( i: number, ele: Ele ) => matches ( ele, comparator )
: isFunction ( comparator )
? comparator
: isCash ( comparator )
? ( i, ele ) => comparator.is ( ele )
: ( i, ele ) => ele === comparator;
? ( i: number, ele: Ele ) => comparator.is ( ele )
: ( i: number, ele: Ele ) => ele === comparator;
}
// @require ./cash.ts
let guid = 1;
interface CashStatic {

@@ -10,2 +8,2 @@ guid: number;

cash.guid = guid;
cash.guid = 1;
// @require ./cash.ts
function matches ( ele: HTMLElement, selector: string ): boolean {
function matches ( ele: any, selector: string ): boolean {
const matches = ele && ( ele.matches || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector'] );
const matches = ele && ( ele['matches'] || ele['webkitMatchesSelector'] || ele['mozMatchesSelector'] || ele['msMatchesSelector'] || ele['oMatchesSelector'] );

@@ -13,5 +13,5 @@ return !!matches && matches.call ( ele, selector );

interface CashStatic {
matches ( ele: HTMLElement, selector: string ): boolean;
matches ( ele: any, selector: string ): boolean;
}
cash.matches = matches;
// @require ./variables.ts
function pluck ( arr: ArrayLike<any>, prop: string, deep?: boolean ): ArrayLike<any> {
function pluck<T> ( arr: ArrayLike<T>, prop: string, deep?: boolean ): Array<T> {
const plucked = [];
const plucked: Array<T> = [];

@@ -8,0 +8,0 @@ for ( let i = 0, l = arr.length; i < l; i++ ) {

// @require ./cash.ts
function isCash ( x ): x is Cash {
function isCash ( x: any ): x is Cash {
return x instanceof Cash;
}
function isFunction ( x ): x is Function {
function isWindow ( x: any ): x is Window {
return !!x && x === x.window;
}
function isDocument ( x: any ): x is Document {
return !!x && x.nodeType === 9;
}
function isElement ( x: any ): x is HTMLElement {
return !!x && x.nodeType === 1;
}
function isFunction ( x: any ): x is Function {
return typeof x === 'function';
}
function isString ( x ): x is string {
function isString ( x: any ): x is string {
return typeof x === 'string';
}
function isNumeric ( x ): boolean {
function isNumeric ( x: any ): boolean {
return !isNaN ( parseFloat ( x ) ) && isFinite ( x );

@@ -23,8 +35,10 @@ }

interface CashStatic {
isFunction ( x ): x is Function;
isString ( x ): x is string;
isNumeric ( x ): boolean;
isArray ( x ): x is Array<any>;
isWindow ( x: any ): x is Window;
isFunction ( x: any ): x is Function;
isString ( x: any ): x is string;
isNumeric ( x: any ): boolean;
isArray ( x: any ): x is Array<any>;
}
cash.isWindow = isWindow;
cash.isFunction = isFunction;

@@ -31,0 +45,0 @@ cash.isString = isString;

interface Cash {
[index: number]: Window & Document & HTMLElement & Element & Node; //FIXME: Quick and dirty way of getting rid of most type errors
[index: number]: Ele;
length: number;
splice ( start: number, deleteCount?: number );
splice ( start: number, deleteCount: number, ...items: Ele[] );
splice ( start: number, deleteCount?: number ): Ele[];
splice ( start: number, deleteCount: number, ...items: Ele[] ): Ele[];
}

@@ -17,4 +17,15 @@

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 Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash;
type Comparator = string | Ele | Cash | (( this: Ele, index: number, ele: Ele ) => boolean);
type Context = Document | HTMLElement | Element;
type EventObj = Event & {
__delegate?: boolean,
namespace?: string,
data?: any
};
type EventCallback = {
( event: EventObj, data?: any ): any,
guid?: number
};

@@ -5,10 +5,10 @@

function unique ( arr: ArrayLike<any> ): ArrayLike<any> {
return arr.length > 1 ? filter.call ( arr, ( item, index, self ) => indexOf.call ( self, item ) === index ) : arr;
function unique<T> ( arr: ArrayLike<T> ): ArrayLike<T> {
return arr.length > 1 ? filter.call ( arr, ( item: T, index: number, self: ArrayLike<T> ) => indexOf.call ( self, item ) === index ) : arr;
}
interface CashStatic {
unique ( arr: ArrayLike<any> ): ArrayLike<any>;
unique<T> ( arr: ArrayLike<T> ): ArrayLike<T>;
}
cash.unique = unique;

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

interface Cash {
css ( prop: string );
css ( prop: string, value ): this;
css ( prop: string ): string | undefined;
css ( prop: string, value: string ): this;
css ( props: plainObject ): this;
}
function css ( this: Cash, prop: string );
function css ( this: Cash, prop: string, value ): Cash;
function css ( this: Cash, prop: string ): string | undefined;
function css ( this: Cash, prop: string, value: string ): Cash;
function css ( this: Cash, prop: plainObject ): Cash;
function css ( this: Cash, prop: string | plainObject, value? ) {
function css ( this: Cash, prop: string | plainObject, value?: string ) {

@@ -36,7 +36,7 @@ if ( isString ( prop ) ) {

if ( ele.nodeType !== 1 ) return;
if ( !isElement ( ele ) ) return;
if ( isVariable ) {
ele.style.setProperty ( prop, value );
ele.style.setProperty ( prop as string, value ); //TSC

@@ -53,3 +53,3 @@ } else {

for ( let key in prop ) {
for ( const key in prop ) {

@@ -56,0 +56,0 @@ this.css ( key, prop[key] );

// @require ./compute_style.ts
function computeStyleInt ( ele: HTMLElement, prop: string ): number {
function computeStyleInt ( ele: Ele, prop: string ): number {

@@ -6,0 +6,0 @@ return parseInt ( computeStyle ( ele, prop ), 10 ) || 0;

// @require core/type_checking.ts
// @require core/variables.ts
function computeStyle ( ele: HTMLElement, prop: string, isVariable?: boolean ): undefined | string {
function computeStyle ( ele: Ele, prop: string, isVariable?: boolean ): string | undefined {
if ( ele.nodeType !== 1 || !prop ) return;
if ( !isElement ( ele ) || !prop ) return;

@@ -8,0 +9,0 @@ const style = win.getComputedStyle ( ele, null );

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

const prefixedProps: plainObject = {},
const prefixedProps: { [prop: string]: string } = {},
{style} = div,

@@ -11,0 +11,0 @@ vendorsPrefixes = ['webkit', 'moz', 'ms', 'o'];

@@ -5,3 +5,3 @@

const numericProps = {
const numericProps: { [prop: string]: true | undefined } = {
animationIterationCount: true,

@@ -20,3 +20,3 @@ columnCount: true,

function getSuffixedValue ( prop: string, value: number | string, isVariable: boolean = isCSSVariable ( prop ) ): number | string {
function getSuffixedValue ( prop: string, value: string, isVariable: boolean = isCSSVariable ( prop ) ): string {

@@ -23,0 +23,0 @@ return !isVariable && !numericProps[prop] && isNumeric ( value ) ? `${value}px` : value;

@@ -11,4 +11,4 @@

data (): plainObject | undefined;
data ( name: string );
data ( name: string, value ): this;
data ( name: string ): any;
data ( name: string, value: any ): this;
data ( datas: plainObject ): this;

@@ -18,6 +18,6 @@ }

function data ( this: Cash ): plainObject | undefined;
function data ( this: Cash, name: string );
function data ( this: Cash, name: string, value ): Cash;
function data ( this: Cash, name: string ): any;
function data ( this: Cash, name: string, value: any ): Cash;
function data ( this: Cash, name: plainObject ): Cash;
function data ( this: Cash, name?: string | plainObject, value? ) {
function data ( this: Cash, name?: string | plainObject, value?: any ) {

@@ -28,3 +28,3 @@ if ( !name ) {

const datas = {};
const datas: { [data: string]: any } = {};

@@ -53,3 +53,3 @@ each ( this[0].attributes, ( i, attr ) => {

for ( let key in name ) {
for ( const key in name ) {

@@ -56,0 +56,0 @@ this.data ( key, name[key] );

// @require core/camel_case.ts
function getData ( ele: HTMLElement, key: string ) {
function getData ( ele: Ele, key: string ): any {

@@ -6,0 +6,0 @@ const value = ele.dataset ? ele.dataset[key] || ele.dataset[camelCase ( key )] : ele.getAttribute ( `data-${key}` );

// @require core/camel_case.ts
function setData ( ele: HTMLElement, key: string, value ): void {
function setData ( ele: Ele, key: string, value: any ): void {

@@ -6,0 +6,0 @@ try {

// @require css/helpers/compute_style_int.ts
function getExtraSpace ( ele: HTMLElement, xAxis?: boolean ): number {
function getExtraSpace ( ele: Element, xAxis?: boolean ): number {
return computeStyleInt ( ele, `border${ xAxis ? 'Left' : 'Top' }Width` ) + computeStyleInt ( ele, `padding${ xAxis ? 'Left' : 'Top' }` ) + computeStyleInt ( ele, `padding${ xAxis ? 'Right' : 'Bottom' }` ) + computeStyleInt ( ele, `border${ xAxis ? 'Right' : 'Bottom' }Width` );
}
// @require core/cash.ts
// @require core/each.ts
// @require core/type_checking.ts
// @require core/variables.ts
interface Cash {
innerWidth (): number;
innerHeight (): number;
innerWidth (): number | undefined;
innerHeight (): number | undefined;
}
each ( ['Width', 'Height'], ( i, prop: string ) => {
each ( ['Width', 'Height'], ( i, prop: 'Width' | 'Height' ) => {
Cash.prototype[`inner${prop}`] = function () {
Cash.prototype[`inner${prop}`] = function ( this: Cash ) {
if ( !this[0] ) return;
if ( this[0] === win ) return win[`inner${prop}`];
if ( isWindow ( this[0] ) ) return win[`inner${prop}`];

@@ -19,0 +20,0 @@ return this[0][`client${prop}`];

@@ -5,2 +5,3 @@

// @require core/each.ts
// @require core/type_checking.ts
// @require core/variables.ts

@@ -18,5 +19,5 @@ // @require css/helpers/compute_style.ts

each ( ['width', 'height'], ( index: number, prop: string ) => {
each ( ['width', 'height'], ( index: number, prop: 'width' | 'height' ) => {
Cash.prototype[prop] = function ( value?: number | string ) {
Cash.prototype[prop] = function ( this: Cash, value?: number | string ) {

@@ -27,3 +28,3 @@ if ( !this[0] ) return value === undefined ? undefined : this;

if ( this[0] === win ) return this[0][ camelCase ( `outer-${prop}` )];
if ( isWindow ( this[0] ) ) return this[0][ camelCase ( `outer-${prop}` )];

@@ -34,7 +35,7 @@ return this[0].getBoundingClientRect ()[prop] - getExtraSpace ( this[0], !index );

const valueNumber = parseInt ( value as string, 10 );
const valueNumber = parseInt ( value as string, 10 ); //TSC
return this.each ( ( i, ele ) => {
if ( ele.nodeType !== 1 ) return;
if ( !isElement ( ele ) ) return;

@@ -41,0 +42,0 @@ const boxSizing = computeStyle ( ele, 'boxSizing' );

// @require core/cash.ts
// @require core/each.ts
// @require core/type_checking.ts
// @require core/variables.ts

@@ -14,7 +15,7 @@ // @require css/helpers/compute_style_int.ts

Cash.prototype[`outer${prop}`] = function ( includeMargins?: boolean ) {
Cash.prototype[`outer${prop}`] = function ( this: Cash, includeMargins?: boolean ) {
if ( !this[0] ) return;
if ( this[0] === win ) return win[`outer${prop}`];
if ( isWindow ( this[0] ) ) return win[`outer${prop}`];

@@ -21,0 +22,0 @@ return this[0][`offset${prop}`] + ( includeMargins ? computeStyleInt ( this[0], `margin${ !index ? 'Left' : 'Top' }` ) + computeStyleInt ( this[0], `margin${ !index ? 'Right' : 'Bottom' }` ) : 0 );

// @require css/helpers/compute_style.ts
const defaultDisplay = {};
const defaultDisplay: { [tagName: string]: string } = {};

@@ -6,0 +6,0 @@ function getDefaultDisplay ( tagName: string ): string {

// @require css/helpers/compute_style.ts
function isHidden ( ele: HTMLElement ): boolean {
function isHidden ( ele: Element ): boolean {

@@ -6,0 +6,0 @@ return computeStyle ( ele, 'display' ) === 'none';

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

function addEvent ( ele: Ele, name: string, namespaces: string[], selector: string, callback: Function ): void {
function addEvent ( ele: Ele, name: string, namespaces: string[], selector: string, callback: EventCallback ): void {
callback['guid'] = ( callback['guid'] || guid++ );
callback.guid = callback.guid || cash.guid++;

@@ -15,4 +15,4 @@ const eventCache = getEventsCache ( ele );

ele.addEventListener ( name, callback as EventListener ); //TSC
ele.addEventListener ( name, callback );
}
// @require ./variables.ts
function getEventNameBubbling ( name: string ) {
function getEventNameBubbling ( name: string ): string {

@@ -6,0 +6,0 @@ return eventsHover[name] || eventsFocus[name] || name;

// @require ./variables.ts
function getEventsCache ( ele: Ele ): plainObject {
function getEventsCache ( ele: Ele ): { [event: string]: [string[], string, EventCallback][] } {

@@ -6,0 +6,0 @@ return ele[eventsNamespace] = ( ele[eventsNamespace] || {} );

function hasNamespaces ( ns1: string[], ns2: string[] ): boolean {
return !ns2 || !some.call ( ns2, ns => ns1.indexOf ( ns ) < 0 );
return !ns2 || !some.call ( ns2, ( ns: string ) => ns1.indexOf ( ns ) < 0 );
}

@@ -6,3 +6,3 @@

function removeEvent ( ele: Ele, name?: string, namespaces?: string[], selector?: string, callback?: Function ): void {
function removeEvent ( ele: Ele, name?: string, namespaces?: string[], selector?: string, callback?: EventCallback ): void {

@@ -25,3 +25,3 @@ const cache = getEventsCache ( ele );

if ( ( callback && cb['guid'] !== callback['guid'] ) || !hasNamespaces ( ns, namespaces ) || ( selector && selector !== sel ) ) return true;
if ( ( callback && cb.guid !== callback.guid ) || !hasNamespaces ( ns, namespaces ) || ( selector && selector !== sel ) ) return true;

@@ -28,0 +28,0 @@ ele.removeEventListener ( name, cb );

const eventsNamespace = '__cashEvents',
eventsNamespacesSeparator = '.',
eventsFocus = { focus: 'focusin', blur: 'focusout' },
eventsHover = { mouseenter: 'mouseover', mouseleave: 'mouseout' },
eventsFocus: { [event: string]: string | undefined } = { focus: 'focusin', blur: 'focusout' },
eventsHover: { [event: string]: string | undefined } = { mouseenter: 'mouseover', mouseleave: 'mouseout' },
eventsMouseRe = /^(?:mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;

@@ -13,7 +13,7 @@

off ( events: string ): this;
off ( events: string, callback: Function ): this;
off ( events: string, selector: string, callback: Function ): this;
off ( events: string, callback: EventCallback ): this;
off ( events: string, selector: string, callback: EventCallback ): this;
}
Cash.prototype.off = function ( this: Cash, eventFullName?: string, selector?: string | Function, callback?: Function ) {
Cash.prototype.off = function ( this: Cash, eventFullName?: string, selector?: string | EventCallback, callback?: EventCallback ) {

@@ -20,0 +20,0 @@ if ( eventFullName === undefined ) {

@@ -17,14 +17,14 @@

on ( events: plainObject ): this;
on ( events: string, callback: Function, _one?: boolean ): this;
on ( events: string, selector: string | Function, callback: Function, _one?: boolean ): this;
on ( events: string, callback: EventCallback, _one?: boolean ): this;
on ( events: string, selector: string | EventCallback, callback: EventCallback, _one?: boolean ): this;
}
function on ( this: Cash, eventFullName: plainObject ): Cash;
function on ( this: Cash, eventFullName: string, callback: Function, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string, selector: string | Function, callback: Function, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string | plainObject, selector?: string | Function, callback?: boolean | Function, _one?: boolean ) {
function on ( this: Cash, eventFullName: string, callback: EventCallback, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string, selector: string | EventCallback, callback: EventCallback, _one?: boolean ): Cash;
function on ( this: Cash, eventFullName: string | plainObject, selector?: string | EventCallback, callback?: boolean | EventCallback, _one?: boolean ) {
if ( !isString ( eventFullName ) ) {
for ( let key in eventFullName ) {
for ( const key in eventFullName ) {

@@ -52,7 +52,7 @@ this.on ( key, selector, eventFullName[key] );

const finalCallback = function ( event ) {
const finalCallback = function ( event: EventObj ) {
if ( event.namespace && !hasNamespaces ( namespaces, event.namespace.split ( eventsNamespacesSeparator ) ) ) return;
let thisArg = ele;
let thisArg: EventTarget = ele;

@@ -65,3 +65,3 @@ if ( selector ) {

if ( target === ele ) return;
target = target.parentNode;
target = target['parentNode'];
if ( !target ) return;

@@ -87,3 +87,3 @@ }

const returnValue = ( callback as Function ).call ( thisArg, event, event.data ); //TSC
const returnValue = ( callback as EventCallback ).call ( thisArg, event, event.data ); //TSC

@@ -105,3 +105,3 @@ if ( _one ) {

finalCallback['guid'] = callback['guid'] = ( callback['guid'] || guid++ );
finalCallback.guid = callback['guid'] = ( callback['guid'] || cash.guid++ ); //TSC

@@ -108,0 +108,0 @@ addEvent ( ele, name, namespaces, selector as string, finalCallback ); //TSC

@@ -7,13 +7,13 @@

one ( events: plainObject ): this;
one ( events: string, callback: Function ): this;
one ( events: string, selector: string | Function, callback: Function ): this;
one ( events: string, callback: EventCallback ): this;
one ( events: string, selector: string | EventCallback, callback: EventCallback ): this;
}
function one ( this: Cash, eventFullName: plainObject ): Cash;
function one ( this: Cash, eventFullName: string, callback: Function ): Cash;
function one ( this: Cash, eventFullName: string, selector: string | Function, callback: Function ): Cash;
function one ( this: Cash, eventFullName: string | plainObject, selector?: string | Function, callback?: Function ) {
return this.on ( ( eventFullName as string ), selector, callback, true ); //TSC
function one ( this: Cash, eventFullName: string, callback: EventCallback ): Cash;
function one ( this: Cash, eventFullName: string, selector: string | EventCallback, callback: EventCallback ): Cash;
function one ( this: Cash, eventFullName: string | plainObject, selector?: string | EventCallback, callback?: EventCallback ) {
return this.on ( eventFullName as string, selector, callback, true ); //TSC
};
Cash.prototype.one = one;

@@ -10,8 +10,8 @@

interface Cash {
trigger ( event: string | Event, data? ): this;
trigger ( event: Event | string, data?: any ): this;
}
Cash.prototype.trigger = function ( this: Cash, eventFullName: string | Event, data? ) {
Cash.prototype.trigger = function ( this: Cash, eventFullName: Event | string, data?: any ) {
let evt: string | Event = eventFullName;
let evt: EventObj;

@@ -25,15 +25,19 @@ if ( isString ( eventFullName ) ) {

evt.initEvent ( name, true, true );
evt['namespace'] = namespaces.join ( eventsNamespacesSeparator );
evt.namespace = namespaces.join ( eventsNamespacesSeparator );
} else {
evt = eventFullName;
}
evt['data'] = data;
evt.data = data;
const isEventFocus = ( evt['type'] in eventsFocus );
const isEventFocus = ( evt.type in eventsFocus );
return this.each ( ( i, ele ) => {
if ( isEventFocus && isFunction ( ele[evt['type']] ) ) {
if ( isEventFocus && isFunction ( ele[evt.type] ) ) {
ele[evt['type']]();
ele[evt.type]();

@@ -40,0 +44,0 @@ } else {

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

function getValue ( ele ): string | string[] {
function getValue ( ele: Ele ): string | string[] {
if ( ele.multiple ) return pluck ( filter.call ( ele.options, option => option.selected && !option.disabled && !option.parentNode.disabled ), 'value' ) as string[];
if ( ele.multiple ) return pluck ( filter.call ( ele.options, option => option.selected && !option.disabled && !option.parentNode.disabled ), 'value' );

@@ -10,0 +10,0 @@ return ele.value || '';

@@ -10,3 +10,3 @@

val (): string | string[];
val ( value ): this;
val ( value: string | string[] ): this;
}

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

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

const ele = this[0];
return this.each ( ( i, ele ) => {
if ( ele ) {
while ( ele.firstChild ) {

@@ -21,6 +19,4 @@

}
});
return this;
};
// @require collection/filter.ts
// @require collection/filter.ts
// @require traversal/find.ts

@@ -9,7 +8,7 @@

function evalScripts ( node: Node ) {
function evalScripts ( node: Node ): void {
const collection = cash ( node );
collection.filter ( 'script' ).add ( collection.find ( 'script' ) ).each ( ( i, ele ) => {
collection.filter ( 'script' ).add ( collection.find ( 'script' ) ).each ( ( i, ele: HTMLScriptElement ) => {
if ( !ele.src && scriptTypeRe.test ( ele.type ) ) { // The script type is supported

@@ -16,0 +15,0 @@ if ( ele.ownerDocument.documentElement.contains ( ele ) ) { // The element is attached to the DOM // Using `documentElement` for broader browser support

@@ -8,4 +8,4 @@

each ( parent, ( index: number, parentEle: HTMLElement ) => {
each ( child, ( i, childEle: HTMLElement ) => {
each ( parent, ( index: number, parentEle: Ele ) => {
each ( child, ( i, childEle: Ele ) => {
insertElement ( parentEle, !index ? childEle : childEle.cloneNode ( true ), prepend, prepend && parentEle.firstChild );

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

// @require ./eval_scripts.ts
function insertElement ( anchor: Node, child: Node, prepend?: boolean, prependTarget?: Node ): void {
function insertElement ( anchor: Ele, child: Ele, prepend?: boolean, prependTarget?: Element ): void {

@@ -6,0 +6,0 @@ if ( prepend ) {

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

cash ( selector ).each ( ( index: number, ele: HTMLElement ) => {
cash ( selector ).each ( ( index: number, ele: Ele ) => {

@@ -15,0 +15,0 @@ const parent = ele.parentNode;

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

cash ( selector ).each ( ( index: number, ele: HTMLElement ) => {
cash ( selector ).each ( ( index: number, ele: Ele ) => {

@@ -15,0 +15,0 @@ const parent = ele.parentNode;

@@ -18,3 +18,3 @@

let wrapper = structure[0] as Element;
let wrapper = structure[0];

@@ -21,0 +21,0 @@ while ( wrapper.children.length ) wrapper = wrapper.firstElementChild;

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

// @require collection/each.ts
// @require collection/filter.ts

@@ -16,8 +15,12 @@ interface Cash {

let result: Ele[] | Cash = [];
const result: Ele[] = [];
this.each ( ( i, ele ) => { push.apply ( result, ele.children ) } );
this.each ( ( i, ele ) => {
push.apply ( result, ele.children );
});
return filtered ( cash ( unique ( result ) ), comparator );
};

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

let result: Ele[] = [];
const result: Ele[] = [];

@@ -15,0 +15,0 @@ this.each ( ( i, ele ) => {

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

const comparator = isString ( selector )
? ( i, ele ) => !!find ( selector, ele ).length
: ( i, ele ) => ele.contains ( selector );
? ( i: number, ele: Ele ) => !!find ( selector, ele ).length
: ( i: number, ele: Ele ) => ele.contains ( selector );

@@ -18,0 +18,0 @@ return this.filter ( comparator );

// @require core/cash.ts
// @require core/filtered.ts
// @require collection/filter.ts
// @require core/unique.ts
// @require core/variables.ts
// @require collection/each.ts
// @require ./children.ts

@@ -14,6 +16,12 @@ // @require ./parent.ts

const ele = this[0];
const result: Ele[] = [];
return filtered ( this.parent ().children ().filter ( ( i, child ) => child !== ele ), comparator );
this.each ( ( i, ele ) => {
push.apply ( result, cash ( ele ).parent ().children ( ( ci, child ) => child !== ele ) );
});
return filtered ( cash ( unique ( result ) ), comparator );
};

@@ -7,3 +7,5 @@

<div class="uncle"></div>\
<div class="aunt"></div>\
<div class="aunt">\
<div class="cousin">content</div>\
</div>\
';

@@ -184,6 +186,19 @@

t.is ( parent.contents ().length, 0 );
t.is ( parent.contents ().length, 0 );
});
it ( 'supports multiple elements in the collection', function ( t ) {
var parent = $('.parent');
var aunt = $('.aunt');
var parents = parent.add ( aunt );
parents.empty ();
t.is ( parent.contents ().length, 0 );
t.is ( aunt.contents ().length, 0 );
});
});

@@ -190,0 +205,0 @@

@@ -319,2 +319,12 @@

it ( 'supports multiple elements in the collection', function ( t ) {
var eles = $('.child, .next');
var siblings = $('.parent').children ();
t.is ( eles.siblings ().length, siblings.length );
t.is ( eles.siblings ().not ( siblings ).length, 0 ); // The returned nodes aren't ordered
});
it ( 'supports selector', function ( t ) {

@@ -321,0 +331,0 @@

@@ -135,2 +135,18 @@

describe ( '$.isWindow', function ( it ) {
it ( 'checks if the passed variable is a window', function ( t ) {
t.true ( $.isWindow ( window ) );
t.false ( $.isWindow ( document ) );
t.false ( $.isWindow ( 'foo' ) );
t.false ( $.isWindow ( true ) );
t.false ( $.isWindow ( 123 ) );
t.false ( $.isWindow ([ 1, 2, 3 ]) );
t.false ( $.isWindow ( function () {} ) );
});
});
describe ( '$.matches', function ( it ) {

@@ -137,0 +153,0 @@

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