Skip to content

Commit 9b74348

Browse files
Bumped version to 3.1.0
1 parent 1e2c317 commit 9b74348

7 files changed

Lines changed: 30 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### Version 3.1.0
2+
- Improved support for running selectors inside documents
3+
- Ensuring Cash collections are iterable
4+
- Added an extra reference implementation for shorthand event methods
5+
- Added an extra reference implementation for `$.getScript`
6+
- Readme: mentioning the extra methods
7+
18
### Version 3.0.0
29
- Added a changelog
310
- Migration guide: mentioning the `zoom` property

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ If you're migrating from jQuery be sure to read our [migration guide](https://gi
3030

3131
## Usage
3232

33-
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:
33+
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:
3434

3535
```html
36-
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/3.0.0/cash.min.js"></script>
36+
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/3.1.0/cash.min.js"></script>
3737
<script>
3838
$(function () {
3939
$('html').addClass ( 'dom-loaded' );

dist/cash.esm.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const doc = document, win = window, div = doc.createElement('div'), { filter, in
33
const idRe = /^#[\w-]*$/, classRe = /^\.[\w-]*$/, htmlRe = /<.+>/, tagRe = /^\w+$/;
44
// @require ./variables.ts
55
function find(selector, context = doc) {
6-
return context !== doc && context.nodeType !== 1
6+
return context !== doc && context.nodeType !== 1 && context.nodeType !== 9
77
? []
88
: classRe.test(selector)
99
? context.getElementsByClassName(selector.slice(1))
@@ -48,6 +48,9 @@ const cash = Cash.prototype.init;
4848
cash.fn = cash.prototype = Cash.prototype; // Ensuring that `cash () instanceof cash`
4949
Cash.prototype.length = 0;
5050
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
51+
if (typeof Symbol === 'function') {
52+
Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];
53+
}
5154
Cash.prototype.get = function (index) {
5255
if (index === undefined)
5356
return slice.call(this);

dist/cash.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function find(selector, context) {
2424
context = doc;
2525
}
2626

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

@@ -70,6 +70,10 @@ cash.fn = cash.prototype = Cash.prototype; // Ensuring that `cash () instanceof
7070
Cash.prototype.length = 0;
7171
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
7272

73+
if (typeof Symbol === 'function') {
74+
Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];
75+
}
76+
7377
Cash.prototype.get = function (index) {
7478
if (index === undefined) return slice.call(this);
7579
return this[index < 0 ? index + this.length : index];

dist/cash.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cash.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const idRe = /^#[\w-]*$/,
3434

3535
function find ( selector: string, context: Context = doc ) {
3636

37-
return context !== doc && context.nodeType !== 1
37+
return context !== doc && context.nodeType !== 1 && context.nodeType !== 9
3838
? []
3939
: classRe.test ( selector )
4040
? context.getElementsByClassName ( selector.slice ( 1 ) )
@@ -103,6 +103,10 @@ cash.fn = cash.prototype = Cash.prototype; // Ensuring that `cash () instanceof
103103
Cash.prototype.length = 0;
104104
Cash.prototype.splice = splice; // Ensuring a cash collection gets printed as array-like in Chrome
105105

106+
if ( typeof Symbol === 'function' ) {
107+
Cash.prototype[Symbol['iterator']] = Array.prototype[Symbol['iterator']];
108+
}
109+
106110

107111
// @require core/cash.ts
108112
// @require core/variables.ts

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cash-dom",
33
"description": "An absurdly small jQuery alternative for modern browsers.",
4-
"version": "3.0.0",
4+
"version": "3.1.0",
55
"license": "MIT",
66
"main": "./dist/cash.js",
77
"module": "./dist/cash.esm.js",

0 commit comments

Comments
 (0)