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

cash-dom

Package Overview
Dependencies
Maintainers
3
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cash-dom - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

src/extra/get_script.ts

7

CHANGELOG.md

@@ -0,1 +1,8 @@

### Version 3.1.0
- Improved support for running selectors inside documents
- Ensuring Cash collections are iterable
- Added an extra reference implementation for shorthand event methods
- Added an extra reference implementation for `$.getScript`
- Readme: mentioning the extra methods
### Version 3.0.0

@@ -2,0 +9,0 @@ - Added a changelog

5

dist/cash.esm.js

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

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

@@ -52,2 +52,5 @@ : classRe.test(selector)

Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
if (typeof Symbol === 'function') {
Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];
}
Cash.prototype.get = function (index) {

@@ -54,0 +57,0 @@ if (index === undefined)

6

dist/cash.js

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

return context !== doc && context.nodeType !== 1 ? [] : classRe.test(selector) ? context.getElementsByClassName(selector.slice(1)) : tagRe.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector);
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);
} // @require ./find.ts

@@ -74,2 +74,6 @@ // @require ./variables.ts

if (typeof Symbol === 'function') {
Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];
}
Cash.prototype.get = function (index) {

@@ -76,0 +80,0 @@ if (index === undefined) return slice.call(this);

/* MIT https://github.com/kenwheeler/cash */
(function(){
'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 w(a,b){void 0===b&&(b=e);return b!==e&&1!==b.nodeType?[]:da.test(a)?b.getElementsByClassName(a.slice(1)):fa.test(a)?b.getElementsByTagName(a):b.querySelectorAll(a)}
'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 w(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 x=function(){function a(a,c){void 0===c&&(c=e);if(a){if(a instanceof x)return a;var b=a;if(y(a)){if(b=c instanceof x?c[0]:c,b=ca.test(a)?b.getElementById(a.slice(1)):ea.test(a)?z(a):w(a,b),!b)return}else if(A(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}(),B=x.prototype.init;B.fn=B.prototype=x.prototype;x.prototype.length=0;x.prototype.splice=ba;
x.prototype.get=function(a){return void 0===a?u.call(this):this[0>a?a+this.length:a]};x.prototype.eq=function(a){return B(this.get(a))};x.prototype.first=function(){return this.eq(0)};x.prototype.last=function(){return this.eq(-1)};x.prototype.map=function(a){return B(aa.call(this,function(b,c){return a.call(b,c,b)}))};x.prototype.slice=function(){return B(u.apply(this,arguments))};var ha=/-([a-z])/g;function ia(a,b){return b.toUpperCase()}function C(a){return a.replace(ha,ia)}B.camelCase=C;
function D(a,b){for(var c=0,d=a.length;c<d&&!1!==b.call(a[c],c,a[c]);c++);}B.each=D;x.prototype.each=function(a){D(this,a);return this};x.prototype.removeProp=function(a){return this.each(function(b,c){delete c[a]})};function E(a){for(var b=1;b<arguments.length;b++);b=arguments;for(var c=b.length,d=2>c?0:1;d<c;d++)for(var f in b[d])a[f]=b[d][f];return a}x.prototype.extend=function(a){return E(B.fn,a)};B.extend=E;var F=1;B.guid=F;
function G(a,b){var c=a&&(a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector);return!!c&&c.call(a,b)}B.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 A(a){return"function"===typeof a}function y(a){return"string"===typeof a}function ja(a){return!isNaN(parseFloat(a))&&isFinite(a)}var I=Array.isArray;B.isFunction=A;B.isString=y;B.isNumeric=ja;B.isArray=I;
x.prototype.prop=function(a,b){if(a){if(y(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 J(a){return y(a)?function(b,c){return G(c,a)}:A(a)?a:a instanceof x?function(b,c){return a.is(c)}:function(b,c){return c===a}}x.prototype.filter=function(a){if(!a)return B();var b=J(a);return B(m.call(this,function(a,d){return b.call(a,d,a)}))};function K(a,b){return b&&a.length?a.filter(b):a}var ka=/\S+/g;
function L(a){return y(a)?a.match(ka)||[]:[]}x.prototype.hasClass=function(a){return a&&v.call(this,function(b){return b.classList.contains(a)})};x.prototype.removeAttr=function(a){var b=L(a);return b.length?this.each(function(a,d){D(b,function(a,b){d.removeAttribute(b)})}):this};
"function"===typeof Symbol&&(x.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);x.prototype.get=function(a){return void 0===a?u.call(this):this[0>a?a+this.length:a]};x.prototype.eq=function(a){return B(this.get(a))};x.prototype.first=function(){return this.eq(0)};x.prototype.last=function(){return this.eq(-1)};x.prototype.map=function(a){return B(aa.call(this,function(b,c){return a.call(b,c,b)}))};x.prototype.slice=function(){return B(u.apply(this,arguments))};var ha=/-([a-z])/g;
function ia(a,b){return b.toUpperCase()}function C(a){return a.replace(ha,ia)}B.camelCase=C;function D(a,b){for(var c=0,d=a.length;c<d&&!1!==b.call(a[c],c,a[c]);c++);}B.each=D;x.prototype.each=function(a){D(this,a);return this};x.prototype.removeProp=function(a){return this.each(function(b,c){delete c[a]})};function E(a){for(var b=1;b<arguments.length;b++);b=arguments;for(var c=b.length,d=2>c?0:1;d<c;d++)for(var f in b[d])a[f]=b[d][f];return a}x.prototype.extend=function(a){return E(B.fn,a)};
B.extend=E;var F=1;B.guid=F;function G(a,b){var c=a&&(a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector);return!!c&&c.call(a,b)}B.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 A(a){return"function"===typeof a}function y(a){return"string"===typeof a}function ja(a){return!isNaN(parseFloat(a))&&isFinite(a)}var I=Array.isArray;B.isFunction=A;B.isString=y;
B.isNumeric=ja;B.isArray=I;x.prototype.prop=function(a,b){if(a){if(y(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 J(a){return y(a)?function(b,c){return G(c,a)}:A(a)?a:a instanceof x?function(b,c){return a.is(c)}:function(b,c){return c===a}}x.prototype.filter=function(a){if(!a)return B();var b=J(a);return B(m.call(this,function(a,d){return b.call(a,d,a)}))};
function K(a,b){return b&&a.length?a.filter(b):a}var ka=/\S+/g;function L(a){return y(a)?a.match(ka)||[]:[]}x.prototype.hasClass=function(a){return a&&v.call(this,function(b){return b.classList.contains(a)})};x.prototype.removeAttr=function(a){var b=L(a);return b.length?this.each(function(a,d){D(b,function(a,b){d.removeAttribute(b)})}):this};
x.prototype.attr=function(a,b){if(a){if(y(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,f){f.setAttribute(a,b)})}for(c in a)this.attr(c,a[c]);return this}};x.prototype.toggleClass=function(a,b){var c=L(a),d=void 0!==b;return c.length?this.each(function(a,h){D(c,function(a,c){d?b?h.classList.add(c):h.classList.remove(c):h.classList.toggle(c)})}):this};

@@ -11,0 +11,0 @@ x.prototype.addClass=function(a){return this.toggleClass(a,!0)};x.prototype.removeClass=function(a){return arguments.length?this.toggleClass(a,!1):this.attr("class","")};function N(a){return 1<a.length?m.call(a,function(a,c,d){return n.call(d,a)===c}):a}B.unique=N;x.prototype.add=function(a,b){return B(N(this.get().concat(B(a,b).get())))};function O(a,b,c){if(1===a.nodeType&&b)return a=g.getComputedStyle(a,null),b?c?a.getPropertyValue(b)||void 0:a[b]:a}

@@ -37,3 +37,3 @@

return context !== doc && context.nodeType !== 1
return context !== doc && context.nodeType !== 1 && context.nodeType !== 9
? []

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

if ( typeof Symbol === 'function' ) {
Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];
}
// @require core/cash.ts

@@ -110,0 +114,0 @@ // @require core/variables.ts

@@ -109,19 +109,4 @@

If you need to load arbitrary JavaScript files you could use something like this:
If you need to load arbitrary JavaScript files you can find a reference implementation for `$.getScript` [here](https://github.com/kenwheeler/cash/blob/master/src/extra/get_script.ts).
```javascript
function loadScript ( url ) {
return new Promise ( ( resolve, reject ) => {
const script = document.createElement ( 'script' );
const head = document.getElementsByTagName ( 'head' )[0];
const anchor = document.getElementsByTagName ( 'script' )[0];
script.async = true;
script.onload = resolve;
script.onerror = reject;
script.src = url;
head.insertBefore ( script, anchor );
});
}
```
### No CSS auto-suffixing support for `zoom`

@@ -128,0 +113,0 @@

{
"browsers": ["ie >= 10"],
"components": {
"core/export_esm": false
"core/export_esm": false,
"extra/get_script": false,
"extra/shorthands": false
},

@@ -6,0 +8,0 @@ "paths": {

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

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

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

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

@@ -80,2 +80,4 @@ $(function () {

Some [extra methods](https://github.com/kenwheeler/cash/tree/master/src/extra) are available but [disabled](https://github.com/kenwheeler/cash/blob/master/pacco.json#L3) by default.
| Attributes | Collection | CSS | Data | Dimensions | Effects |

@@ -825,2 +827,4 @@ | ------------------------------------ | -------------------------- | -------------------- | ---------------------------------- | ------------------------------------ | -------------------------- |

Some [extra methods](https://github.com/kenwheeler/cash/tree/master/src/extra) are available but [disabled](https://github.com/kenwheeler/cash/blob/master/pacco.json#L3) by default.
| Type Checking | Utilities |

@@ -827,0 +831,0 @@ | ------------------------------- | ----------------------------------- |

@@ -59,1 +59,5 @@

Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
if ( typeof Symbol === 'function' ) {
Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];
}

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

return context !== doc && context.nodeType !== 1
return context !== doc && context.nodeType !== 1 && context.nodeType !== 9
? []

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

@@ -20,2 +20,14 @@

describe ( 'Collections', function ( it ) {
( typeof Symbol === 'function' ? it : it.skip )( 'are iterable', function ( t ) { // It only works on browsers with support for Symbol
var $eles = $('.multiple');
t.true ( $eles[Symbol.iterator] === Array.prototype[Symbol.iterator] );
});
});
describe ( 'Plugins', function ( it ) {

@@ -172,4 +184,15 @@

it ( 'supports a document', function ( t ) {
var doc = document.implementation.createDocument ( 'http://www.w3.org/1999/xhtml', 'html', null ),
ele = $('<p id="foo">')[0];
$(doc.documentElement).append ( ele );
t.is ( $('#foo', doc)[0], ele );
});
});
});
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