Comparing version 4.1.0 to 4.1.1
@@ -0,1 +1,10 @@ | ||
### Version 4.1.1 | ||
- Raising bundle size limit to 5.5kB | ||
- Test: replaced iOS 9.3 with iOS 11.0 | ||
- Test: using setAttribute instead of the dataset API | ||
- Migration guide: mentioning the `:scope` CSS pseudo-class | ||
- Migration guide: mentioning inserting plain text | ||
- TypeScript: typing events more loosely | ||
- TypeScript: typing collection elements more loosely | ||
### Version 4.1.0 | ||
@@ -2,0 +11,0 @@ - Added $.isWindow |
interface Cash { | ||
[index: number]: Ele; | ||
[index: number]: EleAll; | ||
length: number; | ||
@@ -15,12 +15,8 @@ splice(start: number, deleteCount?: number): Ele[]; | ||
declare type Ele = Window | Document | HTMLElement | Element | Node; | ||
declare type EleAll = Window & Document & HTMLElement & Element & Node; | ||
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; | ||
(event: any, data?: any): any; | ||
guid?: number; | ||
@@ -27,0 +23,0 @@ }; |
@@ -570,3 +570,3 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
return; | ||
target = target['parentNode']; | ||
target = target.parentNode; | ||
if (!target) | ||
@@ -573,0 +573,0 @@ return; |
@@ -728,3 +728,3 @@ /* MIT https://github.com/kenwheeler/cash */ | ||
if (target === ele) return; | ||
target = target['parentNode']; | ||
target = target.parentNode; | ||
if (!target) return; | ||
@@ -731,0 +731,0 @@ } |
interface Cash { | ||
[index: number]: Ele; | ||
[index: number]: EleAll; | ||
length: number; | ||
@@ -17,2 +17,3 @@ splice ( start: number, deleteCount?: number ): Ele[]; | ||
type Ele = Window | Document | HTMLElement | Element | Node; | ||
type EleAll = Window & Document & HTMLElement & Element & Node; //UGLY: Trick to remove some kind-of useless type errors //URL: https://github.com/kenwheeler/cash/issues/278 | ||
type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash; | ||
@@ -22,10 +23,4 @@ type Comparator = string | Ele | Cash | (( this: Ele, index: number, ele: Ele ) => boolean); | ||
type EventObj = Event & { | ||
__delegate?: boolean, | ||
namespace?: string, | ||
data?: any | ||
}; | ||
type EventCallback = { | ||
( event: EventObj, data?: any ): any, | ||
( event: any, data?: any ): any, | ||
guid?: number | ||
@@ -1323,3 +1318,3 @@ }; | ||
const finalCallback = function ( event: EventObj ) { | ||
const finalCallback = function ( event ) { | ||
@@ -1336,3 +1331,3 @@ if ( event.namespace && !hasNamespaces ( namespaces, event.namespace.split ( eventsNamespacesSeparator ) ) ) return; | ||
if ( target === ele ) return; | ||
target = target['parentNode']; | ||
target = target.parentNode; | ||
if ( !target ) return; | ||
@@ -1448,3 +1443,3 @@ } | ||
let evt: EventObj; | ||
let evt; | ||
@@ -1451,0 +1446,0 @@ if ( isString ( eventFullName ) ) { |
@@ -16,2 +16,4 @@ | ||
If you only target modern browsers you could use the [`:scope`](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope) CSS pseudo-class. | ||
```javascript | ||
@@ -26,2 +28,6 @@ // jQuery | ||
$('#foo').next ( '.bar' ); | ||
// :scope | ||
$('#foo').find ( ':scope > .bar' ); | ||
$('#foo').find ( ':scope ~ .bar' ); | ||
$('#foo').find ( ':scope + .bar' ); | ||
``` | ||
@@ -76,2 +82,23 @@ | ||
### Inserting plain text | ||
jQuery supports inserting plain text via different methods (`$.fn.after`, `$.fn.append` etc.): | ||
```javascript | ||
$('.foo').append ( 'something' ); | ||
``` | ||
Cash doesn't support that because it instead supports receiving a selector as an argument, and that can be ambigous when also supporting plain text: | ||
```javascript | ||
$('.foo').append ( '.foo' ); // Is that a target or do we actually wanto to append ".foo"? | ||
``` | ||
You should generally wrap your plain texts in a `<span>` element, or create a `textNode` node manually: | ||
```javascript | ||
$('.foo').append ( '<span>something</span>' ); | ||
$('.foo').append ( document.createTextNode ( 'something' ) ); | ||
``` | ||
### Width/height of hidden element | ||
@@ -78,0 +105,0 @@ |
@@ -67,7 +67,7 @@ | ||
}, | ||
ios_9: { | ||
ios_11: { | ||
base: 'SauceLabs', | ||
deviceName: 'iPhone 6 Simulator', | ||
browserName: 'Safari', | ||
platformVersion: '9.3', | ||
platformVersion: '11.0', | ||
platformName: 'iOS' | ||
@@ -74,0 +74,0 @@ }, |
{ | ||
"name": "cash-dom", | ||
"description": "An absurdly small jQuery alternative for modern browsers.", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"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/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: | ||
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.1/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@4.1.1/dist/cash.min.js) and use it like this: | ||
```html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.0/cash.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/4.1.1/cash.min.js"></script> | ||
<script> | ||
@@ -39,0 +39,0 @@ $(function () { |
interface Cash { | ||
[index: number]: Ele; | ||
[index: number]: EleAll; | ||
length: number; | ||
@@ -17,2 +17,3 @@ splice ( start: number, deleteCount?: number ): Ele[]; | ||
type Ele = Window | Document | HTMLElement | Element | Node; | ||
type EleAll = Window & Document & HTMLElement & Element & Node; //UGLY: Trick to remove some kind-of useless type errors //URL: https://github.com/kenwheeler/cash/issues/278 | ||
type Selector = falsy | string | Function | HTMLCollection | NodeList | Ele | Ele[] | ArrayLike<Ele> | Cash; | ||
@@ -22,11 +23,5 @@ type Comparator = string | Ele | Cash | (( this: Ele, index: number, ele: Ele ) => boolean); | ||
type EventObj = Event & { | ||
__delegate?: boolean, | ||
namespace?: string, | ||
data?: any | ||
}; | ||
type EventCallback = { | ||
( event: EventObj, data?: any ): any, | ||
( event: any, data?: any ): any, | ||
guid?: number | ||
}; |
@@ -51,3 +51,3 @@ | ||
const finalCallback = function ( event: EventObj ) { | ||
const finalCallback = function ( event ) { | ||
@@ -64,3 +64,3 @@ if ( event.namespace && !hasNamespaces ( namespaces, event.namespace.split ( eventsNamespacesSeparator ) ) ) return; | ||
if ( target === ele ) return; | ||
target = target['parentNode']; | ||
target = target.parentNode; | ||
if ( !target ) return; | ||
@@ -67,0 +67,0 @@ } |
@@ -15,3 +15,3 @@ | ||
let evt: EventObj; | ||
let evt; | ||
@@ -18,0 +18,0 @@ if ( isString ( eventFullName ) ) { |
@@ -48,3 +48,3 @@ | ||
t.is ( ele.data ( 'one' ), 'one' ); | ||
ele[0].dataset.one = 'uno'; | ||
ele[0].setAttribute( 'data-one', 'uno' ); | ||
t.is ( ele.data ( 'one' ), 'uno' ); | ||
@@ -51,0 +51,0 @@ |
Sorry, the diff of this file is not supported yet
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
715089
7876