Comparing version 6.0.1 to 6.0.2
@@ -0,1 +1,6 @@ | ||
### Version 6.0.2 | ||
- Readme: improved comparison with jQuery, fixing some wrong/unfair comparisons/statements | ||
- Migration guide: mentioning sort order | ||
- $.fn.ready: ensuring the callback is called asynchronously and errors are not silenced | ||
### Version 6.0.1 | ||
@@ -2,0 +7,0 @@ - Ensuring events work with Document and Window objects |
@@ -685,3 +685,3 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
fn.ready = function (callback) { | ||
const cb = () => attempt(callback, cash); | ||
const cb = () => setTimeout(callback, 0, cash); | ||
if (doc.readyState !== 'loading') { | ||
@@ -688,0 +688,0 @@ cb(); |
@@ -844,3 +844,3 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
var cb = function cb() { | ||
return attempt(callback, cash); | ||
return setTimeout(callback, 0, cash); | ||
}; | ||
@@ -847,0 +847,0 @@ |
@@ -12,3 +12,3 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
F.toggleClass=function(a,b){var c=N(a),d=void 0!==b;return this.each(function(a,f){B(f)&&I(c,function(a,c){d?b?f.classList.add(c):f.classList.remove(c):f.classList.toggle(c)})})};F.addClass=function(a){return this.toggleClass(a,!0)};F.removeClass=function(a){return arguments.length?this.toggleClass(a,!1):this.attr("class","")}; | ||
function O(a,b,c,d){for(var h=[],f=E(b),k=d&&L(d),q=0,S=a.length;q<S;q++)if(f){var l=b(a[q]);l.length&&ha.apply(h,l)}else for(l=a[q][b];!(null==l||d&&k(-1,l));)h.push(l),l=c?l[b]:null;return h}function P(a){return 1<a.length?w.call(a,function(a,c,d){return ea.call(d,a)===c}):a}G.unique=P;F.add=function(a,b){return G(P(this.get().concat(G(a,b).get())))};function Q(a,b,c){if(B(a))return a=n.getComputedStyle(a,null),c?a.getPropertyValue(b)||void 0:a[b]}function R(a,b){return parseInt(Q(a,b),10)||0} | ||
function O(a,b,c,d){for(var h=[],f=E(b),k=d&&L(d),q=0,R=a.length;q<R;q++)if(f){var l=b(a[q]);l.length&&ha.apply(h,l)}else for(l=a[q][b];!(null==l||d&&k(-1,l));)h.push(l),l=c?l[b]:null;return h}function P(a){return 1<a.length?w.call(a,function(a,c,d){return ea.call(d,a)===c}):a}G.unique=P;F.add=function(a,b){return G(P(this.get().concat(G(a,b).get())))};function Q(a,b,c){if(B(a))return a=n.getComputedStyle(a,null),c?a.getPropertyValue(b)||void 0:a[b]}function S(a,b){return parseInt(Q(a,b),10)||0} | ||
var T=/^--/,U={},ta=aa.style,ua=["webkit","moz","ms"];function va(a,b){void 0===b&&(b=T.test(a));if(b)return a;if(!U[a]){b=H(a);var c=""+b[0].toUpperCase()+b.slice(1);b=(b+" "+ua.join(c+" ")+c).split(" ");I(b,function(b,c){if(c in ta)return U[a]=c,!1})}return U[a]} | ||
@@ -18,11 +18,11 @@ var wa={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function xa(a,b,c){void 0===c&&(c=T.test(a));return c||wa[a]||!ra(b)?b:b+"px"} | ||
F.data=function(a,b){if(!a){if(!this[0])return;var c={},d;for(d in this[0].dataset)c[d]=za(this[0],d);return c}if(D(a))return 2>arguments.length?this[0]&&za(this[0],a):void 0===b?this:this.each(function(c,d){c=b;c=g(JSON.stringify,c);d.dataset[H(a)]=c});for(d in a)this.data(d,a[d]);return this};function Aa(a,b){var c=a.documentElement;return Math.max(a.body["scroll"+b],c["scroll"+b],a.body["offset"+b],c["offset"+b],c["client"+b])} | ||
function Ba(a,b){return R(a,"border"+(b?"Left":"Top")+"Width")+R(a,"padding"+(b?"Left":"Top"))+R(a,"padding"+(b?"Right":"Bottom"))+R(a,"border"+(b?"Right":"Bottom")+"Width")} | ||
I([!0,!1],function(a,b){I(["Width","Height"],function(a,d){F[(b?"outer":"inner")+d]=function(c){if(this[0])return K(this[0])?b?this[0]["inner"+d]:this[0].document.documentElement["client"+d]:A(this[0])?Aa(this[0],d):this[0][(b?"offset":"client")+d]+(c&&b?R(this[0],"margin"+(a?"Top":"Left"))+R(this[0],"margin"+(a?"Bottom":"Right")):0)}})}); | ||
function Ba(a,b){return S(a,"border"+(b?"Left":"Top")+"Width")+S(a,"padding"+(b?"Left":"Top"))+S(a,"padding"+(b?"Right":"Bottom"))+S(a,"border"+(b?"Right":"Bottom")+"Width")} | ||
I([!0,!1],function(a,b){I(["Width","Height"],function(a,d){F[(b?"outer":"inner")+d]=function(c){if(this[0])return K(this[0])?b?this[0]["inner"+d]:this[0].document.documentElement["client"+d]:A(this[0])?Aa(this[0],d):this[0][(b?"offset":"client")+d]+(c&&b?S(this[0],"margin"+(a?"Top":"Left"))+S(this[0],"margin"+(a?"Bottom":"Right")):0)}})}); | ||
I(["Width","Height"],function(a,b){var c=b.toLowerCase();F[c]=function(d){if(!this[0])return void 0===d?void 0:this;if(!arguments.length)return K(this[0])?this[0].document.documentElement["client"+b]:A(this[0])?Aa(this[0],b):this[0].getBoundingClientRect()[c]-Ba(this[0],!a);var h=parseInt(d,10);return this.each(function(b,d){B(d)&&(b=Q(d,"boxSizing"),d.style[c]=xa(c,h+("border-box"===b?Ba(d,!a):0)))})}});var V={}; | ||
F.toggle=function(a){return this.each(function(b,c){if(B(c))if(void 0===a?"none"===Q(c,"display"):a){if(c.style.display=c.___cd||"","none"===Q(c,"display")){b=c.style;c=c.tagName;if(V[c])c=V[c];else{var d=r(c);m.body.insertBefore(d,null);var h=Q(d,"display");m.body.removeChild(d);c=V[c]="none"!==h?h:"block"}b.display=c}}else c.___cd=Q(c,"display"),c.style.display="none"})};F.hide=function(){return this.toggle(!1)};F.show=function(){return this.toggle(!0)}; | ||
function Ca(a,b){return!b||!x.call(b,function(b){return 0>a.indexOf(b)})}var W={focus:"focusin",blur:"focusout"},Da={mouseenter:"mouseover",mouseleave:"mouseout"},Ea=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Fa(a,b,c,d,h){var f=a.___ce=a.___ce||{};f[b]=f[b]||[];f[b].push([c,d,h]);a.addEventListener(b,h)}function X(a){a=a.split(".");return[a[0],a.slice(1).sort()]} | ||
function Y(a,b,c,d,h){var f=a.___ce=a.___ce||{};if(b)f[b]&&(f[b]=f[b].filter(function(f){var k=f[0],S=f[1];f=f[2];if(h&&f.guid!==h.guid||!Ca(k,c)||d&&d!==S)return!0;a.removeEventListener(b,f)}));else for(b in f)Y(a,b,c,d,h)} | ||
function Y(a,b,c,d,h){var f=a.___ce=a.___ce||{};if(b)f[b]&&(f[b]=f[b].filter(function(f){var k=f[0],R=f[1];f=f[2];if(h&&f.guid!==h.guid||!Ca(k,c)||d&&d!==R)return!0;a.removeEventListener(b,f)}));else for(b in f)Y(a,b,c,d,h)} | ||
F.off=function(a,b,c){var d=this;if(void 0===a)this.each(function(a,b){(B(b)||A(b)||K(b))&&Y(b)});else if(D(a))E(b)&&(c=b,b=""),I(N(a),function(a,h){a=X(Da[h]||W[h]||h);var f=a[0],k=a[1];d.each(function(a,d){(B(d)||A(d)||K(d))&&Y(d,f,k,b,c)})});else for(var h in a)this.off(h,a[h]);return this}; | ||
F.on=function(a,b,c,d,h){var f=this;if(!D(a)){for(var k in a)this.on(k,b,c,a[k],h);return this}D(b)||(void 0!==b&&null!==b&&(void 0!==c&&(d=c),c=b),b="");E(d)||(d=c,c=void 0);if(!d)return this;I(N(a),function(a,k){a=X(Da[k]||W[k]||k);var l=a[0],q=a[1];l&&f.each(function(a,f){if(B(f)||A(f)||K(f))a=function Ja(a){if(!a.namespace||Ca(q,a.namespace.split("."))){var k=f;if(b){for(var z=a.target;!qa(z,b);){if(z===f)return;z=z.parentNode;if(!z)return}k=z;a.___cd=!0}a.___cd&&Object.defineProperty(a,"currentTarget", | ||
{configurable:!0,get:function(){return k}});Object.defineProperty(a,"data",{configurable:!0,get:function(){return c}});z=d.call(k,a,a.___td);h&&Y(f,l,q,b,Ja);!1===z&&(a.preventDefault(),a.stopPropagation())}},a.guid=d.guid=d.guid||G.guid++,Fa(f,l,q,b,a)})});return this};F.one=function(a,b,c,d){return this.on(a,b,c,d,!0)};F.ready=function(a){function b(){return g(a,G)}"loading"!==m.readyState?b():m.addEventListener("DOMContentLoaded",b);return this}; | ||
{configurable:!0,get:function(){return k}});Object.defineProperty(a,"data",{configurable:!0,get:function(){return c}});z=d.call(k,a,a.___td);h&&Y(f,l,q,b,Ja);!1===z&&(a.preventDefault(),a.stopPropagation())}},a.guid=d.guid=d.guid||G.guid++,Fa(f,l,q,b,a)})});return this};F.one=function(a,b,c,d){return this.on(a,b,c,d,!0)};F.ready=function(a){function b(){return setTimeout(a,0,G)}"loading"!==m.readyState?b():m.addEventListener("DOMContentLoaded",b);return this}; | ||
F.trigger=function(a,b){if(D(a)){var c=X(a),d=c[0];c=c[1];if(!d)return this;var h=Ea.test(d)?"MouseEvents":"HTMLEvents";a=m.createEvent(h);a.initEvent(d,!0,!0);a.namespace=c.join(".")}a.___td=b;var f=a.type in W;return this.each(function(b,c){if(f&&E(c[a.type]))c[a.type]();else c.dispatchEvent(a)})};function Ga(a){return a.multiple&&a.options?O(w.call(a.options,function(a){return a.selected&&!a.disabled&&!a.parentNode.disabled}),"value"):a.value||""} | ||
@@ -34,3 +34,3 @@ var Ha=/%20/g,Ia=/\r?\n/g,Ka=/file|reset|submit|button|image/i,La=/radio|checkbox/i;F.serialize=function(){var a="";this.each(function(b,c){I(c.elements||[c],function(b,c){c.disabled||!c.name||"FIELDSET"===c.tagName||Ka.test(c.type)||La.test(c.type)&&!c.checked||(b=Ga(c),void 0!==b&&(b=u(b)?b:[b],I(b,function(b,d){b=a;d="&"+encodeURIComponent(c.name)+"="+encodeURIComponent(d.replace(Ia,"\r\n")).replace(Ha,"+");a=b+d})))})});return a.slice(1)}; | ||
F.offset=function(){var a=this[0];if(a)return a=a.getBoundingClientRect(),{top:a.top+n.pageYOffset,left:a.left+n.pageXOffset}};F.offsetParent=function(){return this.map(function(a,b){for(a=b.offsetParent;a&&"static"===Q(a,"position");)a=a.offsetParent;return a||p})}; | ||
F.position=function(){var a=this[0];if(a){var b="fixed"===Q(a,"position"),c=b?a.getBoundingClientRect():this.offset();if(!b){var d=a.ownerDocument;for(b=a.offsetParent||d.documentElement;(b===d.body||b===d.documentElement)&&"static"===Q(b,"position");)b=b.parentNode;b!==a&&B(b)&&(d=G(b).offset(),c.top-=d.top+R(b,"borderTopWidth"),c.left-=d.left+R(b,"borderLeftWidth"))}return{top:c.top-R(a,"marginTop"),left:c.left-R(a,"marginLeft")}}}; | ||
F.position=function(){var a=this[0];if(a){var b="fixed"===Q(a,"position"),c=b?a.getBoundingClientRect():this.offset();if(!b){var d=a.ownerDocument;for(b=a.offsetParent||d.documentElement;(b===d.body||b===d.documentElement)&&"static"===Q(b,"position");)b=b.parentNode;b!==a&&B(b)&&(d=G(b).offset(),c.top-=d.top+S(b,"borderTopWidth"),c.left-=d.left+S(b,"borderLeftWidth"))}return{top:c.top-S(a,"marginTop"),left:c.left-S(a,"marginLeft")}}}; | ||
F.children=function(a){return M(G(P(O(this,function(a){return a.children}))),a)};F.contents=function(){return G(P(O(this,function(a){return"IFRAME"===a.tagName?[a.contentDocument]:"TEMPLATE"===a.tagName?a.content.childNodes:a.childNodes})))};F.find=function(a){return G(P(O(this,function(b){return y(a,b)})))};var Pa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Qa=/^$|^module$|\/(java|ecma)script/i,Ra=["type","src","nonce","noModule"]; | ||
@@ -37,0 +37,0 @@ function Sa(a,b){a=G(a);a.filter("script").add(a.find("script")).each(function(a,d){if(Qa.test(d.type)&&p.contains(d)){var c=r("script");c.text=d.textContent.replace(Pa,"");I(Ra,function(a,b){d[b]&&(c[b]=d[b])});b.head.insertBefore(c,null);b.head.removeChild(c)}})} |
{ | ||
"name": "cash-dom", | ||
"description": "An absurdly small jQuery alternative for modern browsers.", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "browser": "./dist/cash.js", |
@@ -12,18 +12,19 @@ | ||
| Size | Cash | Zepto 1.2.0 | jQuery 3.4.1 | | ||
| ------------------ | ----------- | ----------- | ------------ | | ||
| Unminified | **34.6 KB** | 58.7 KB | 280 KB | | ||
| Minified | **15.2 KB** | 26 KB | 88.1 KB | | ||
| Minified & Gzipped | **5.6 KB** | 9.8 KB | 30.7 KB | | ||
| Size | Cash | Zepto 1.2.0 | jQuery Slim 3.4.1 | | ||
| ------------------ | ----------- | ----------- | ----------------- | | ||
| Unminified | **34.9 KB** | 58.7 KB | 227 KB | | ||
| Minified | **15.3 KB** | 26 KB | 71 KB | | ||
| Minified & Gzipped | **5.7 KB** | 9.8 KB | 24.4 KB | | ||
An **82%** gain in size reduction compared to jQuery. If you need a smaller bundle, we support [partial builds](https://github.com/kenwheeler/cash/blob/master/docs/partial_builds.md) too. | ||
A **76.6%** gain in size reduction compared to jQuery. If you need a smaller bundle, we support [partial builds](https://github.com/kenwheeler/cash/blob/master/docs/partial_builds.md) too. | ||
| Features | Cash | Zepto 1.2.0 | jQuery 3.4.1 | | ||
| ------------------------ | ---------------------------- | ------------------------------ | ------------------------ | | ||
| Supports Modern Browsers | ✔ | ️✔ | ✔ | | ||
| Actively Maintained | ✔ | ❌ | ✔ | | ||
| Namespaced Events | ✔ | ️❌ | ✔ | | ||
| Modern Codebase | ✔ (TypeScript) | ️❌ | ❌ | | ||
| TypeScript Types | ✔ (generated from code) | ⚠️ (via DefinitelyTyped) | ⚠️ (via DefinitelyTyped) | | ||
| Partial Builds | ✔ (can exclude single files) | ⚠️ (can exclude whole modules) | ❌ | | ||
| Features | Cash | Zepto 1.2.0 | jQuery Slim 3.4.1 | | ||
| ------------------------ | ---------------------------------- | ------------------------------ | ------------------------------ | | ||
| Supports Older Browsers | ❌ | ️❌ | ✔ | | ||
| Supports Modern Browsers | ✔ | ️✔ | ✔ | | ||
| Actively Maintained | ✔ | ❌ | ✔ | | ||
| Namespaced Events | ✔ | ️❌ | ✔ | | ||
| Typed Codebase | ✔ (TypeScript) | ️❌ | ❌ | | ||
| TypeScript Types | ✔ (generated from code) | ⚠️ (via DefinitelyTyped) | ⚠️ (via DefinitelyTyped) | | ||
| Partial Builds | ✔ (can exclude individual methods) | ⚠️ (can exclude whole modules) | ⚠️ (can exclude whole modules) | | ||
@@ -34,6 +35,6 @@ If you're migrating from jQuery be sure to read our [migration guide](https://github.com/kenwheeler/cash/blob/master/docs/migration_guide.md). | ||
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/6.0.1/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@6.0.1/dist/cash.min.js) and use it like this: | ||
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/6.0.2/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@6.0.2/dist/cash.min.js) and use it like this: | ||
```html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/6.0.1/cash.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/6.0.2/cash.min.js"></script> | ||
<script> | ||
@@ -291,3 +292,3 @@ $(function () { | ||
Iterates over a collection with `callback ( index, element )`. | ||
Iterates over a collection with `callback ( index, element )`. The callback function may exit iteration early by returning `false`. | ||
@@ -882,6 +883,6 @@ ```js | ||
Iterates through an array and calls the `callback ( value, index, array )` method on each. | ||
Iterates through an array and calls the `callback ( index, element )` method on each element. The callback function may exit iteration early by returning `false`. | ||
```js | ||
$.each ( array, callback ) // => undefined | ||
$.each ( array, callback ) // => array | ||
``` | ||
@@ -888,0 +889,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
226000
964