cash-dom
Advanced tools
Comparing version 8.0.0 to 8.1.0
479
CHANGELOG.md
@@ -1,18 +0,32 @@ | ||
### Version 8.0.0 | ||
### [v8.1.0](https://github.com/fabiospampinato/cash/releases/tag/8.1.0) (2020-09-12) | ||
- Added `$.isPlainObject` | ||
- $.each: added support for iterating over objects | ||
- $.extend: added support for extending deeply | ||
- Readme: updated dimensions | ||
- Updated changelog template | ||
### [v8.0.0](https://github.com/fabiospampinato/cash/releases/tag/8.0.0) (2020-06-20) | ||
- Improved alignment with jQuery regarding handling of non-bubbling events significantly | ||
### Version 7.0.4 | ||
### [v7.0.4](https://github.com/fabiospampinato/cash/releases/tag/7.0.4) (2020-06-19) | ||
- Ensuring unusual but valid simple selectors are handled properly | ||
### Version 7.0.3 | ||
- Updated “EleLoose” type | ||
### [v7.0.3](https://github.com/fabiospampinato/cash/releases/tag/7.0.3) (2020-05-31) | ||
### Version 7.0.2 | ||
- Updated "EleLoose" type | ||
### v7.0.2 (2020-05-30) | ||
- Readme: updated npm installation command | ||
- Updated the “EleLoose” TypeScript type ensuring it isn’t evaluated as “never” | ||
- Updated the "EleLoose" TypeScript type ensuring it isn't evaluated as "never" | ||
### Version 7.0.1 | ||
### [v7.0.1](https://github.com/fabiospampinato/cash/releases/tag/7.0.1) (2020-04-15) | ||
- $.fn.css: added support for retrieving properties of disconnected nodes | ||
### Version 7.0.0 | ||
### [v7.0.0](https://github.com/fabiospampinato/cash/releases/tag/7.0.0) (2020-03-31) | ||
- focus|blur|mouseenter|mouseleave: ensuring namespaces are handled properly | ||
@@ -23,3 +37,4 @@ - focus|blur|mouseenter|mouseleave: aligned behavior more with jQuery | ||
### Version 6.0.2 | ||
### [v6.0.2](https://github.com/fabiospampinato/cash/releases/tag/6.0.2) (2020-02-15) | ||
- Readme: improved comparison with jQuery, fixing some wrong/unfair comparisons/statements | ||
@@ -29,15 +44,18 @@ - Migration guide: mentioning sort order | ||
### Version 6.0.1 | ||
### [v6.0.1](https://github.com/fabiospampinato/cash/releases/tag/6.0.1) (2020-01-05) | ||
- Ensuring events work with Document and Window objects | ||
- Ensuring “event.data” is setted reliably | ||
- Ensuring "event.data" is setted reliably | ||
### Version 6.0.0 | ||
### [v6.0.0](https://github.com/fabiospampinato/cash/releases/tag/6.0.0) (2020-01-05) | ||
##### Removed Features | ||
- $.camelCase|matches|isString|prefixedProp: no longer exposing these methods, aligning with jQuery | ||
##### New Features | ||
- $.fn.nextUntil|prevUntil|parentsUntil: implemented these methods | ||
- $.fn.detach|remove: added support for an optional "selector" argument | ||
- $.fn.on|one: added support for an optional “data” argument | ||
- $.fn.on|one: added support for an optional "data" argument | ||
- Set-up test coverage (currently at ~99%) reporting to coveralls.io | ||
@@ -47,19 +65,20 @@ - Migration guide: major update | ||
##### Bug Fixes | ||
- $.extend: aligned more with jQuery when called with zero or one argument | ||
- $.fn.before|after|append|prepend|insertBefore|insertAfter|appendTo|prependTo: ensuring cloned scripts don't get executed | ||
- $.fn.contents: ensuring template elements are supported | ||
- $.fn.css: ensuring “grid-*“ properties don’t get the “px” suffix appended to their values when they are not supposed to | ||
- $.fn.css: ensuring "grid-*" properties don't get the "px" suffix appended to their values when they are not supposed to | ||
- $.fn.data: doing nothing when trying to set values to undefined | ||
- $.fn.data: ensuring strings containing leading/trailing whitespace aren’t parsed as JSON | ||
- $.fn.data: ensuring strings containing leading/trailing whitespace aren't parsed as JSON | ||
- $.fn.get|eq: ensuring string indexes are supported | ||
- $.fn.map: ensuring callbacks that return an array of elements are supported too | ||
- $.fn.offset|offsetParent|position: rewritten to much more closely match jQuery’s implementation | ||
- $.fn.offset|offsetParent|position: rewritten to much more closely match jQuery's implementation | ||
- $.fn.on|one|off: ensuring namespaces-only events are ignored | ||
- $.fn.on|one|off: ensuring they don’t throw when receiving a falsy callback | ||
- $.fn.on|one|off: ensuring they don't throw when receiving a falsy callback | ||
- $.fn.on|one: ensuring these methods are chainable even when receiving falsy callbacks | ||
- $.fn.prop|removeProp: mapping special HTML attributes into their equivalent DOM properties (e.g. “for” -> “htmlFor”) | ||
- $.fn.prop|removeProp: mapping special HTML attributes into their equivalent DOM properties (e.g. "for" -> "htmlFor") | ||
- $.fn.ready: ensuring exceptions are always caught, so they can't crash the app | ||
- $.fn.serialize: normalizing newlines | ||
- $.fn.trigger: testing that non-nil falsy values are passed correctly | ||
- $.fn.unwrap: ensuring immediate children of the body don’t get unwrapped | ||
- $.fn.unwrap: ensuring immediate children of the body don't get unwrapped | ||
- $.fn.val: ensuring checkboxes and radios can be set properly | ||
@@ -70,18 +89,19 @@ - $.fn.val: ensuring non-string values are supported | ||
- $.fn.width|height|innerWidth|innerHeight|outerWidth|outerHeight: ensuring they return the right value for the Window object | ||
- $.fn.wrapAll: ensuring elements aren’t cloned unnecessarely | ||
- $.fn.wrapAll: ensuring elements aren't cloned unnecessarely | ||
- $.parseHTML: ensuring whitespace around a single HTML tag is preserved | ||
- Ensuring empty selectors don’t throw an error | ||
- Ensuring empty selectors don't throw an error | ||
- Collections containing non-element objects: | ||
- $.fn.addClass|removeClass|toggleClass: ensuring it doesn’t throw with collections containing non-elements | ||
- $.fn.attr: ensuring a collection containing non-element objects doesn’t cause an error to be thrown | ||
- $.fn.addClass|removeClass|toggleClass: ensuring it doesn't throw with collections containing non-elements | ||
- $.fn.attr: ensuring a collection containing non-element objects doesn't cause an error to be thrown | ||
- $.fn.before|after|append|prepend|insertBefore|insertAfter|appendTo|prependTo: ensuring non-element nodes are accounted for properly | ||
- $.fn.hasClass: ensuring a collection containing non-element objects doesn’t cause an error to be thrown | ||
- $.fn.hide|show|toggle: ensuring a collection containing non-element objects doesn’t cause an error to be thrown | ||
- $.fn.hasClass: ensuring a collection containing non-element objects doesn't cause an error to be thrown | ||
- $.fn.hide|show|toggle: ensuring a collection containing non-element objects doesn't cause an error to be thrown | ||
- $.fn.html: ensuring collections containing non-element objects are supported | ||
- $.fn.not: ensuring non-element nodes are excluded | ||
- $.fn.on|off: ensuring non-element objects in the collection are ignored | ||
- $.fn.removeAttr: ensuring a collection containing non-element objects doesn’t cause an error to be thrown | ||
- $.fn.removeAttr: ensuring a collection containing non-element objects doesn't cause an error to be thrown | ||
- $.fn.text: improved support of collections containing non-elements objects | ||
### Version 5.0.0 | ||
### [v5.0.0](https://github.com/fabiospampinato/cash/releases/tag/5.0.0) (2019-12-17) | ||
- Dropped support for IE10 | ||
@@ -93,12 +113,14 @@ - $.fn.hasClass: ensuring it always returns a boolean | ||
- Ensuring attached events never get forgotten | ||
- Ensuring script tags are executed even if they have a “src” attribute, and without using `eval` | ||
- Ensuring the order of event namespaces doesn’t matter | ||
- Ensuring script tags are executed even if they have a "src" attribute, and without using `eval` | ||
- Ensuring the order of event namespaces doesn't matter | ||
- Squeezed some more bytes out of the bundle (~4%) and improved code style consistency | ||
- Squeezed some more bytes out of the bundle (~1.5%), bringing back the minified and gzipped size below 5kb | ||
### Version 4.1.5 | ||
- $.fn.val: ensuring it works with “input[type=file][multiple]” elements | ||
### [v4.1.5](https://github.com/fabiospampinato/cash/releases/tag/4.1.5) (2019-09-06) | ||
- $.fn.val: ensuring it works with "input[type=file][multiple]" elements | ||
- Migration guide: mentioning how $.fn.data stores values | ||
### Version 4.1.4 | ||
### [v4.1.4](https://github.com/fabiospampinato/cash/releases/tag/4.1.4) (2019-08-05) | ||
- $.fn.get: improved types | ||
@@ -110,4 +132,5 @@ - TypeScript: made types a little more forgiving | ||
### Version 4.1.3 | ||
- Ensuring Cash can be bundled correctly via WebPack | ||
### [v4.1.3](https://github.com/fabiospampinato/cash/releases/tag/4.1.3) (2019-07-13) | ||
- Ensuring Cash can be bundled correctly via webpack | ||
- $.fn.toggle: ensuring each element is toggled independently | ||
@@ -117,6 +140,8 @@ - TypeScript: ensuring some useful internal types are exported | ||
### Version 4.1.2 | ||
### [v4.1.2](https://github.com/fabiospampinato/cash/releases/tag/4.1.2) (2019-05-16) | ||
- Avoiding publishing unnecessary files to NPM | ||
### Version 4.1.1 | ||
### [v4.1.1](https://github.com/fabiospampinato/cash/releases/tag/4.1.1) (2019-05-13) | ||
- Raising bundle size limit to 5.5kB | ||
@@ -130,6 +155,7 @@ - Test: replaced iOS 9.3 with iOS 11.0 | ||
### Version 4.1.0 | ||
### [v4.1.0](https://github.com/fabiospampinato/cash/releases/tag/4.1.0) (2019-05-12) | ||
- Added $.isWindow | ||
- Made the TypeScript type system stricter | ||
- $.guid: ensuring it’s properly exported | ||
- $.guid: ensuring it's properly exported | ||
- $.fn.siblings: ensuring it supports multi-element collections | ||
@@ -139,3 +165,4 @@ - $.fn.empty: ensuring it supports multi-element collections | ||
### Version 4.0.0 | ||
### [v4.0.0](https://github.com/fabiospampinato/cash/releases/tag/4.0.0) (2019-05-08) | ||
- Removed `$.fn.removeData` | ||
@@ -146,7 +173,9 @@ - Removed `$.hasData` | ||
### Version 3.2.0 | ||
### [v3.2.0](https://github.com/fabiospampinato/cash/releases/tag/3.2.0) (2019-04-30) | ||
- Readme: updated sizes | ||
- $.fn.off: added support for removing delegated handlers | ||
### Version 3.1.0 | ||
### [v3.1.0](https://github.com/fabiospampinato/cash/releases/tag/3.1.0) (2019-03-22) | ||
- Improved support for running selectors inside documents | ||
@@ -158,17 +187,21 @@ - Ensuring Cash collections are iterable | ||
### Version 3.0.0 | ||
### [v3.0.0](https://github.com/fabiospampinato/cash/releases/tag/3.0.0) (2019-03-17) | ||
- Library rewritten in TypeScript | ||
- Bundle TypeScript typings (no need for @types/cash, which is now obsolete) | ||
- Added a changelog | ||
- Migration guide: mentioning the `zoom` property | ||
- Readme: improved description of the optional context argument (origin/master, origin/HEAD) | ||
- Ensuring valid typescript types are generated | ||
- Ensuring build files are updated when bumping the version | ||
- Migration guide: mention the `zoom` property | ||
- Readme: improved description of the optional context argument | ||
- Ensure valid TypeScript types are generated | ||
- Ensure build files are updated when bumping the version | ||
### Version 3.0.0-beta.3 | ||
### v3.0.0-beta.3 (2018-12-06) | ||
- Fixed export on the ESM build | ||
### Version 3.0.0-beta.2 | ||
- Renamed some “private” variables | ||
- Readme: minor changes | ||
### v3.0.0-beta.2 (2018-11-21) | ||
- Renamed some "private" variables | ||
- Travis: avoiding caching `node_modules` | ||
- Test: improved tests regarding event delegatino | ||
- Test: improved tests regarding event delegating | ||
- Migration guide: added a section about events | ||
@@ -185,3 +218,3 @@ - Moved "@types/*" to "dependencies" | ||
- Generalized `insertElement` to support a custom prepend target | ||
- Evaluating the contnet of `script` tags when attaching them to the DOM | ||
- Evaluating the content of `script` tags when attaching them to the DOM | ||
- Migration guide: added a `loadScript` function | ||
@@ -193,3 +226,4 @@ - find: improved resilience against text/comment/etc. nodes | ||
### Version 3.0.0-beta.1 | ||
### v3.0.0-beta.1 (2018-10-27) | ||
- Merge branch 'master' of github.com:kenwheeler/cash | ||
@@ -212,7 +246,8 @@ - Updated Karma configuration | ||
- Updated readme | ||
- Added a “Migration Guide” | ||
- Added a "Migration Guide" | ||
- Added `$.fn.hide|show|toggle` | ||
- Added `$.fn.unwrap|wrap|wrapAll|wrapInner` | ||
### Version 3.0.0-beta.0 | ||
### v3.0.0-beta.0 (2018-10-26) | ||
- Test: added Firefox to Karma | ||
@@ -225,3 +260,3 @@ - Rewritten test suite | ||
- computeStyle: check if a property is actually passed | ||
- computeStyle: returning `undefined` for unset css variables | ||
- computeStyle: returning `undefined` for unset CSS variables | ||
- Added `@types/node` as a dev dependency | ||
@@ -242,3 +277,2 @@ - camelCase: removed description | ||
- Creating one fewer div element | ||
- Minor changes | ||
- unique: improved performance | ||
@@ -249,11 +283,9 @@ - Updated logo | ||
### Version 2.3.9 | ||
### [v2.3.9](https://github.com/fabiospampinato/cash/releases/tag/2.3.9) (2018-10-21) | ||
### Version 2.3.8 | ||
### Version 2.3.9 | ||
- Changed files extensions to `ts` | ||
- $.parseHTML: fixed a regression regarding non-browser environments | ||
### Version 2.3.8 | ||
### [v2.3.8](https://github.com/fabiospampinato/cash/releases/tag/2.3.8) (2018-10-20) | ||
- Updated some dependencies | ||
@@ -268,9 +300,10 @@ - Test: added `travis_retry` to tests with SauceLabs | ||
- $.fn.val: properly handling `null` | ||
- $.fn.append|prepend: ensuring it doesn’t throw when passed `undefined` | ||
- $.fn.append|prepend: ensuring it doesn't throw when passed `undefined` | ||
- $.parseHTML: added support for malformed single-tags | ||
- $.parseHTML: added support for parsing thead/tbody/tfoot/tr/td/th elements | ||
- Test: removed the “ Passed!” suffix from messages | ||
- Test: removed the " Passed!" suffix from messages | ||
- Test: fixed some malformed HTML | ||
### Version 2.3.7 | ||
### [v2.3.7](https://github.com/fabiospampinato/cash/releases/tag/2.3.7) (2018-10-14) | ||
- Added cross-platform tests with SauceLabs | ||
@@ -282,12 +315,12 @@ - Test only against node LTS | ||
- Added some issue templates | ||
- Readme: added a “Contributing” section | ||
- Readme: added a "Contributing" section | ||
- Renamed `prepublish` script to `prepublishOnly` | ||
- Ensuring `$.parseHTML` always preserves the content of nodes | ||
### Version 2.3.6 | ||
- chore(README): npm always lowercase | ||
### [v2.3.6](https://github.com/fabiospampinato/cash/releases/tag/2.3.6) (2018-10-03) | ||
- Merge pull request #201 from limonte/patch-1 | ||
- chore(tests): bump qunit to latest | ||
- Merge pull request #202 from limonte/upgrade-qunit | ||
- ci: setup karma test runner + travis | ||
- CI: set up Karma test runner + Travis | ||
- Readme: removed travis-ci badge | ||
@@ -298,21 +331,23 @@ - Coding-style normalization | ||
- Test: ensuring there are no syntax errors on IE11 | ||
- tests: use npm ci | ||
- chore: use Node.js 10 | ||
- Readme: added a “License” section | ||
- Readme: added a “Thanks” section | ||
- Readme: added a "License" section | ||
- Readme: added a "Thanks" section | ||
- Optimize .empty(), use removeChild() instead of .innerHTML = '' | ||
- `$.fn.empty`: updated code style | ||
### Version 2.3.5 | ||
### [v2.3.5](https://github.com/fabiospampinato/cash/releases/tag/2.3.5) (2018-09-08) | ||
- Improved support for Node.js | ||
### Version 2.3.4 | ||
### v2.3.4 (2018-09-07) | ||
- Moved `pacco` to `devDependencies` | ||
### Version 2.3.3 | ||
- cash: using the provided context when selecting by id | ||
- cash: added support for using a cash object as the context | ||
### [v2.3.3](https://github.com/fabiospampinato/cash/releases/tag/2.3.3) (2018-07-09) | ||
- using the provided context when selecting by id | ||
- added support for using a cash object as the context | ||
- Improved readme | ||
### Version 2.3.2 | ||
### [v2.3.2](https://github.com/fabiospampinato/cash/releases/tag/2.3.2) (2018-07-09) | ||
- Added a logo | ||
@@ -323,12 +358,16 @@ - Ensuring `$.fn.replaceWith` and `$.fn.replaceAll` work with multiple targets | ||
### Version 2.3.1 | ||
### [v2.3.1](https://github.com/fabiospampinato/cash/releases/tag/2.3.1) (2018-07-05) | ||
- Added support for `window` to dimensions-related methods | ||
### Version 2.3.0 | ||
### [v2.3.0](https://github.com/fabiospampinato/cash/releases/tag/2.3.0) (2018-07-05) | ||
- Added a `$.fn.contents` method | ||
### Version 2.2.1 | ||
### [v2.2.1](https://github.com/fabiospampinato/cash/releases/tag/2.2.1) (2018-06-16) | ||
- Ensuring a cash collection gets printed as array-like in Chrome | ||
### Version 2.2.0 | ||
### [v2.2.0](https://github.com/fabiospampinato/cash/releases/tag/2.2.0) (2018-06-10) | ||
- Improved `test:jquery` script | ||
@@ -343,3 +382,3 @@ - Added `$.hasData` | ||
- $.fn.css: ensuring only element nodes are considered | ||
- $.parseHTML: ensuring it doesn’t throw when non-string values are passed to it | ||
- $.parseHTML: ensuring it doesn't throw when non-string values are passed to it | ||
- $.parseHTML: returning an array instead of a `NodeList` | ||
@@ -362,3 +401,4 @@ - $.fn.attr: returning `undefined` instead of `null` for missing attributes | ||
### Version 2.1.8 | ||
### [v2.1.8](https://github.com/fabiospampinato/cash/releases/tag/2.1.8) (2018-06-10) | ||
- Updated some dependencies | ||
@@ -368,3 +408,4 @@ - $.fn.on: calling `preventDefault` and `stopPropagation` on the event if the handler returns `false` | ||
### Version 2.1.7 | ||
### [v2.1.7](https://github.com/fabiospampinato/cash/releases/tag/2.1.7) (2018-05-28) | ||
- Added some more explicit `@require` statements | ||
@@ -374,13 +415,17 @@ - Added a script for rendering the dependencies graph | ||
### Version 2.1.6 | ||
### [v2.1.6](https://github.com/fabiospampinato/cash/releases/tag/2.1.6) (2018-05-19) | ||
- Events: passing the actual target element as `this` for delegated events | ||
### Version 2.1.5 | ||
### [v2.1.5](https://github.com/fabiospampinato/cash/releases/tag/2.1.5) (2018-05-16) | ||
- $.fn.removeClass: fixed attribute resetting | ||
### Version 2.1.4 | ||
- Updated jsDelivr url | ||
### v2.1.4 (2018-05-14) | ||
- Updated jsDelivr URL | ||
- $.fn.trigger: events are now cancelable | ||
### Version 2.1.3 | ||
### [v2.1.3](https://github.com/fabiospampinato/cash/releases/tag/2.1.3) (2018-05-12) | ||
- Merge pull request #184 from fabiospampinato/master | ||
@@ -397,4 +442,2 @@ - $.fn.width|height: fixed a bug with Firefox | ||
- $.fn.index: optimized | ||
- test:watch: watching only the unminified bundle | ||
- Properly wrapping the bundle | ||
- getPrefixedProp: fixed caching logic | ||
@@ -408,10 +451,11 @@ - Major cleanup and bytes squeezing | ||
### Version 2.1.2 | ||
### v2.1.2 (2018-05-11) | ||
- Added some alternative configurations for pacco | ||
- Aligned `$.fn.prop` with jQuery’s | ||
- Aligned `$.fn.removeClass` with jQuery’s | ||
- Aligned `$.fn.prop` with jQuery's | ||
- Aligned `$.fn.removeClass` with jQuery's | ||
- Event delegation: handling the removal of the target from the DOM | ||
- Pre-merge cleanup/update | ||
### Version 2.1.1 | ||
### v2.1.1 (2018-05-03) | ||
- $.parseHTML: added a todo | ||
@@ -422,16 +466,17 @@ - $.fn.filter: optimized | ||
- Minor style changes | ||
- Aligned `$.fn.removeData` with jQuery’s | ||
- Aligned `$.fn.removeData` with jQuery's | ||
### Version 2.1.0 | ||
- Aligned `$.fn.each` with jQuery’s | ||
- Aligned `$.fn.map` with jQuery’s | ||
- Aligned `$.fn.filter` with jQuery’s | ||
### v2.1.0 (2018-04-12) | ||
- Aligned `$.fn.each` with jQuery's | ||
- Aligned `$.fn.map` with jQuery's | ||
- Aligned `$.fn.filter` with jQuery's | ||
- $.fn.height|width: setting to each element in the collection | ||
- $.fn.on: renamed `delegate` to `selector` | ||
- Aligned `$.val` with jQuery’s | ||
- Aligned `$.fn.data` with jQuery’s | ||
- Aligned `$.val` with jQuery's | ||
- Aligned `$.fn.data` with jQuery's | ||
- $.fn.css: automatically adding the `px` suffix when necessary | ||
- Readme: updated minified + gzip size | ||
- $.fn.height: fixed | ||
- Aligned `$.fn.width|height` with jQuery’s | ||
- Aligned `$.fn.width|height` with jQuery's | ||
- Added support for namespaced events | ||
@@ -441,3 +486,4 @@ - $.fn.trigger: ensuring all namespaces match | ||
### Version 2.0.0 | ||
### v2.0.0 (2018-04-08) | ||
- Added a `guid` | ||
@@ -458,3 +504,3 @@ - $.fn.trigger: added support for triggering already-made events | ||
- Ensuring eventCache is properly cleared | ||
- $.fn.off: added support for remiving all handlers | ||
- $.fn.off: added support for removing all handlers | ||
- $.fn.remove: removing also all events | ||
@@ -466,3 +512,2 @@ - Added a `$.fn.detach` method | ||
- Removed event un-namespacing | ||
- Simplified wrapper | ||
- Added support for removing wrapped event handlers | ||
@@ -472,7 +517,6 @@ - Added support for removing handlers attached with `.one` | ||
- Passing data as an argument | ||
- Major refactoring | ||
- Readme: updated links | ||
- Renamed `Global Methods` to `Cash Methods` | ||
- hasClass: properly escaping regex special characters | ||
- $.fn.offsetParent: ensuring it doesn’t throw with an empty collection | ||
- $.fn.offsetParent: ensuring it doesn't throw with an empty collection | ||
- $.fn.removeData: fixed | ||
@@ -483,20 +527,17 @@ - removeData: fixed a variable name | ||
- Requiring pacco@^1.1.0 | ||
- Explicitly compiling for ie >= 9 | ||
- Explicitly compiling for IE >= 9 | ||
- Updated a todo | ||
### Version 1.3.7 | ||
### [v1.3.7](https://github.com/fabiospampinato/cash/releases/tag/1.3.7) (2018-01-17) | ||
### Version 1.3.6 | ||
### [v1.3.6](https://github.com/fabiospampinato/cash/releases/tag/1.3.6) (2018-01-11) | ||
- Test fixes | ||
- 1.3.5 | ||
- Argument required for `createHTMLDocument` | ||
- Run build tasks | ||
- fix: attributes/addClass, the wrong checking on class-name inclusion | ||
- fix: remove `spacedName` from `addClass` interface | ||
- Added travis ci support for modern node versions | ||
- Added Travis CI support for modern node versions | ||
- Merge pull request #160 from amilajack/patch-1 | ||
- Update jsDelivr links | ||
- Merge pull request #168 from LukasDrgon/patch-1 | ||
- fix title | ||
- fix travis setup | ||
- Merge pull request #173 from DanielRuf/patch-travis | ||
@@ -510,8 +551,8 @@ - Merge pull request #171 from DanielRuf/patch-readme | ||
### Version 1.3.5 | ||
- Add test case. | ||
- Normalize all text file in the repo. | ||
- Serialize elemnts outside form as well. | ||
### [v1.3.5](https://github.com/fabiospampinato/cash/releases/tag/1.3.5) (2016-10-12) | ||
- Normalize all text files in the repo | ||
- Serialize elements outside form as well | ||
- Fix for #143 | ||
- fn in should always be called asynchronously | ||
- fn in should always be called asynchronously | ||
- Merge PR #105 'parseHTML-fix' of https://github.com/softwarespot/cash into 1.3.5 | ||
@@ -527,5 +568,16 @@ - Merge PR #116 "Form Cleanup" | ||
### Version 1.3.4 | ||
### [v1.3.4](https://github.com/fabiospampinato/cash/releases/tag/1.3.4) (2016-06-28) | ||
### Version 1.3.0 | ||
### [v1.3.3](https://github.com/fabiospampinato/cash/releases/tag/1.3.3) (2016-05-20) | ||
- Filter fix | ||
### [v1.3.2](https://github.com/fabiospampinato/cash/releases/tag/1.3.2) (2016-05-18) | ||
### [v1.3.1](https://github.com/fabiospampinato/cash/releases/tag/1.3.1) (2016-05-16) | ||
- CDN version links | ||
### [v1.3.0](https://github.com/fabiospampinato/cash/releases/tag/1.3.0) (2016-05-04) | ||
- jQuery 3 comparison | ||
@@ -536,45 +588,11 @@ - Unified compare function for `$.fn.is` and `$.fn.not` to support looking for elements | ||
- Use `$.fn.find` with an element instead of selector. | ||
- Minor cleanup | ||
- Merge branch 'master' of https://github.com/kenwheeler/cash | ||
- Fix for `$.fn.closest` to return correct results, `$.fn.filter` can now filter by Elements | ||
- Cleanup & build | ||
- Fix for #135: `$.fn.closest()` callstack exceeded | ||
- Add semicolon. | ||
- Use `Object.defineProperty` to attach the `constructor` property to the `cash.fn` prototype. #134 | ||
- merge PR #110 | ||
- merge PR #111 | ||
### Version 1.3.4 | ||
### v1.2.3 (2016-??-??) | ||
### Version 1.3.4-rc1 | ||
### Version 1.3.3 | ||
- Merge branch 'master' into filter-fix | ||
- Filter fix | ||
### Version 1.3.2 | ||
### Version 1.3.1 | ||
- CDN Version Links | ||
### Version 1.3.0 | ||
### Version 1.2.0 | ||
- Size updates | ||
- Keep CDN files at last version until the CDNs have had a chance to update. | ||
- Simplified `on` | ||
- Updated README | ||
- Merge pull request #115 from kenwheeler/1.3.0 | ||
### Version 1.3.0 | ||
- merge PR 110 | ||
- merge PR 111 | ||
### Version 1.2.2 | ||
- merge PR 96 | ||
### Version 1.2.1 | ||
- [ attr() ] - fix to return collection for multi-add | ||
- [ update ] - improve based on @shshaw comment https://github.com/kenwheeler/cash/pull/111#issuecomment-216283171 | ||
- Cleanup and @rwwagner90 fix | ||
### Version 1.2.3 | ||
- Saving bytes | ||
@@ -584,23 +602,16 @@ - [ remove class ] - add test for removing all classes | ||
### Version 1.2.2 | ||
### v1.2.2 (2016-??-??) | ||
### Version 1.2.1 | ||
- `$.fn.filter` fix | ||
- merge PR #96 | ||
- [ add / remove / toggle / has class ] - add checks for integers and falsey values - closer to jQuery - was having script-killing errors when `.addClass("")` | ||
### Version 1.2.2 | ||
- [ add / remove / toggle / has class ] - add hecks for integers and falsey values - closer to jQuery - was having script-killing errors when `.addClass("") | ||
### [v1.2.1](https://github.com/fabiospampinato/cash/releases/tag/1.2.1) (2016-04-25) | ||
### Version 1.2.1 | ||
### Version 1.2.2 | ||
- Version bump | ||
- `$.fn.filter` fix | ||
### Version 1.2.1 | ||
- [ attr() ] - fix to return collection for multi-add | ||
- [ update ] - improve based on @shshaw comment https://github.com/kenwheeler/cash/pull/111#issuecomment-216283171 | ||
- Cleanup and @rwwagner90 fix | ||
- CloudFlare CDN | ||
- Clarified intro paragraph | ||
- Updated parseHTML which fixes the base url issue | ||
### Version 1.2.0 | ||
### Version 1.2.1 | ||
- Updated parseHTML which fixes the base URL issue | ||
- Fix conflict | ||
@@ -612,6 +623,2 @@ - Merge branch 'kenwheeler-master' | ||
- Merge pull request #102 from kenwheeler/npm-bower-fixes | ||
### Version 1.2.0 | ||
### Version 1.2.1 | ||
- Update README.md | ||
@@ -628,6 +635,6 @@ - Fix example for $.isArray | ||
- Heading comment | ||
- Set multiple attributes & properties | ||
- Set multiple attributes & properties | ||
- Merge pull request #87 from kenwheeler/attr-obj | ||
- added index to docs | ||
- updated utilities & type checking links | ||
- updated utilities & type checking links | ||
- Merge pull request #89 from devinargenta/docs/index-added | ||
@@ -642,32 +649,33 @@ - Size alignment | ||
### Version 1.2.0 | ||
### [v1.2.0](https://github.com/fabiospampinato/cash/releases/tag/1.2.0) (2016-04-01) | ||
- Merge pull request #1 from shshaw/selector | ||
- Merge pull request #70 from shshaw/master | ||
- Size updates | ||
- Keep CDN files at last version until the CDNs have had a chance to update. | ||
- Simplified `on` | ||
- Updated README | ||
- Merge pull request #115 from kenwheeler/1.3.0 | ||
### Version 1.1.0 | ||
### [v1.1.0](https://github.com/fabiospampinato/cash/releases/tag/1.1.0) (2016-04-12) | ||
- Fixed css() return value for object type input | ||
- Merge pull request #58 from kornalius/master | ||
- Update README.md | ||
- Fixing length to 0 when element doesnt exist | ||
- Fixing length to 0 when element doesn't exist | ||
- Merge pull request #64 from defrag/fix/empty-item-length | ||
- Fixing suite | ||
- Merge pull request #65 from defrag/fix/suite-fix | ||
- This is embarassing | ||
- Better init | ||
- Better `fn.find` | ||
- `return false` break `.each` | ||
- Improve `fn.find` | ||
- `return false` breaks `.each` | ||
- `fn.children` and `fn.is` improvements | ||
- Minor fixes | ||
- Smaller file size & Consistency | ||
- Better `append`, `prepend` | ||
- Smaller file size & consistency | ||
- Improve `append`, `prepend` | ||
- Clone entire collections | ||
- Cleanup | ||
- Added `.map` | ||
- README fixes | ||
- Simplification of manipulations | ||
- Fixed chain ability on `remove` | ||
- Fixed chainability of `remove` | ||
- Traversal cleanup | ||
- Unified collection functions | ||
- Simplified class manipulation | ||
- Cleanup & simplification | ||
- Form fixes | ||
@@ -682,18 +690,12 @@ - Tiny utils added to `cash` | ||
- Merge remote-tracking branch 'kenwheeler/master' | ||
- Tabs to Spaces | ||
- Trimmed `index` | ||
- Direct `map` | ||
- Trimmed `outerWidth` & `outerHeight` | ||
- Trimmed `outerWidth` & `outerHeight` | ||
- Cleaned up events | ||
- spaces instead of tabs | ||
- Minor cleanup | ||
- Form serialize fix | ||
- Merge pull request #67 from shshaw/master | ||
- Merge remote-tracking branch 'kenwheeler/master' | ||
- `after`, `before` & `insert...` | ||
- README cleanup | ||
- Trimming | ||
- README fix | ||
- `after`, `before` & `insert...` | ||
- Updated hints | ||
- Simplified `outerWidth` & `outerHeight` | ||
- Simplified `outerWidth` & `outerHeight` | ||
- Prefixed CSS Properties | ||
@@ -707,21 +709,18 @@ - Selector performance | ||
- `window` fixes | ||
- Clear _eventCache when all removed | ||
- No need for this check | ||
- No need for `i` | ||
- Clear `_eventCache` when all removed | ||
- Private `data` store | ||
- Replace `_eventCache` | ||
- `.one` support | ||
- Move `data` up | ||
- `offset` | ||
- README updates | ||
### Version 1.0.0 | ||
### [v1.0.0](https://github.com/fabiospampinato/cash/releases/tag/1.0.0) (2015-02-06) | ||
- Available in npm as cash-dom now | ||
- Adding is documentation | ||
- Adding `is` documentation | ||
- Add UMD wrapper | ||
- Store references for better minifying | ||
- Fill out package.json | ||
- Cleanup README | ||
- Clean up README | ||
- Merge pull request #40 from hackbone/umd | ||
- Conform to Airbnb javascript style guide | ||
- Conform to Airbnb JavaScript style guide | ||
- Arbitrary stylistic changes for readability | ||
@@ -732,6 +731,6 @@ - Minify dimensions better | ||
- fn reference for minifying | ||
- Cleanup gulpfile and remove beautify | ||
- Clean up gulpfile and remove beautify | ||
- Build lib | ||
- Stop using arguments object when unnecessary for better minifying | ||
- Switch to es6 with 6to5 and update linting | ||
- Switch to ES6 with 6to5 and update linting | ||
- Return target in extend, improve minifying | ||
@@ -744,24 +743,15 @@ - Build lib | ||
### Version 0.0.3 | ||
- Trailing comma | ||
- Closure compiler did me dirty | ||
- README update | ||
- One mo gain | ||
### [v0.0.3](https://github.com/fabiospampinato/cash/releases/tag/0.0.3) (2014-11-09) | ||
- Update README.md | ||
- Merge pull request #9 from richguan/patch-1 | ||
- Merge pull request #7 from Fender123/master | ||
- Committing the dd feature in response to #16 | ||
- Committing the `add` feature in response to #16 | ||
- create tests for .add | ||
- gulped out the dist files | ||
- adding a few more testaroonies | ||
- adding some more testaroonies | ||
- allowing selector string input | ||
- fixing tests for selector string | ||
- - cash creeped back to $ when trying something, fixed. | ||
- Refactoring the $.fn.add method based on Ken's feedback, also update documentation and tests | ||
- Merge pull request #20 from simeydotme/master | ||
- change parents to closest and create new parents | ||
- add tests for parents, closest | ||
- updating documentation for closest and parents | ||
- committing gulped files | ||
- change parents to closest and create new parents | ||
@@ -771,4 +761,2 @@ - Merge branch 'master' of https://github.com/simeydotme/cash | ||
- test that HTML is last item in collection | ||
- tidy up to match original format | ||
- First commit. | ||
- Merge pull request #23 from simeydotme/master | ||
@@ -781,3 +769,3 @@ - Merge pull request #22 from vivekimsit/feature-closest-method | ||
- matches was throwing errors in IE9 | ||
- fix up closest tests, and make the removeclass test more robust | ||
- fix up closest tests, and make the removeClass test more robust | ||
- fix merge error with .closest() | ||
@@ -792,3 +780,2 @@ - make .removeClass() more robust for IE9 | ||
- Fixing #32 | ||
- First commit. | ||
- Adds cash object support. | ||
@@ -802,19 +789,15 @@ - updating addClass function to allow multiple classes and to prevent duplicates in IE9 | ||
- update dist files and test cases | ||
- oopsy, meant to be parentElement | ||
- no need for that variable declaration | ||
- gulp back some refreshing minification | ||
- Merge pull request #37 from simeydotme/patch-parents-with-unique | ||
- Merge pull request #34 from vivekimsit/feature-add-is-support | ||
### Version 0.0.2 | ||
### [v0.0.2](https://github.com/fabiospampinato/cash/releases/tag/0.0.2) (2014-09-27) | ||
- Performance | ||
- Big update | ||
- Fixing readme | ||
- Fixing siblings, making QSA return array | ||
- So dumb | ||
- Fixing _ leak | ||
- Fixing siblings, making qSA return array | ||
- Fixing `_` leak | ||
- Add bower.json | ||
- Merge pull request #3 from digitaljhelms/bower-json | ||
- First round of unit tests + bug fixes | ||
- Fixing README typo & adding License | ||
- Fixing README typo & adding License | ||
- Fixes | ||
@@ -830,9 +813,9 @@ - Adding "auto-off" event registration and indexing | ||
- Merge pull request #10 from mienaikoe/master | ||
- Fixing html() & append returns | ||
- Fixing html() & append returns | ||
- Merge branch 'master' of https://github.com/kenwheeler/cash | ||
### Version 0.0.1 | ||
### [v0.0.1](https://github.com/fabiospampinato/cash/releases/tag/0.0.1) (2014-09-19) | ||
- Initial commit | ||
- Initial commit | ||
- README & Homepage | ||
- README & Homepage | ||
- Update README.md |
@@ -26,2 +26,3 @@ interface Event { | ||
declare type Context = Document | HTMLElement | Element; | ||
declare type PlainObject<T> = Record<string, T>; | ||
declare type EventCallback = { | ||
@@ -43,28 +44,33 @@ (event: any, data?: any): any; | ||
} | ||
declare type EachCallback<T> = (this: T, index: number, ele: T) => any; | ||
interface CashStatic { | ||
each<T>(arr: ArrayLike<T>, callback: EachCallback<T>): void; | ||
guid: number; | ||
} | ||
interface CashStatic { | ||
isWindow(x: any): x is Window; | ||
isFunction(x: any): x is Function; | ||
isArray(x: any): x is Array<any>; | ||
isNumeric(x: any): boolean; | ||
isPlainObject(x: any): x is PlainObject<any>; | ||
} | ||
interface Cash { | ||
each(callback: EachCallback<EleLoose>): this; | ||
get(): EleLoose[]; | ||
get(index: number): EleLoose | undefined; | ||
} | ||
interface Cash { | ||
removeProp(prop: string): this; | ||
eq(index: number): Cash; | ||
} | ||
interface CashStatic { | ||
extend(): any; | ||
extend(target: any): typeof cash; | ||
extend(target: any, ...objs: any[]): any; | ||
interface Cash { | ||
first(): Cash; | ||
} | ||
interface Cash { | ||
extend(plugins: Record<any, any>): this; | ||
last(): Cash; | ||
} | ||
declare type EachArrayCallback<T> = (this: T, index: number, ele: T) => any; | ||
declare type EachObjectCallback<T> = (this: T, key: string, value: T) => any; | ||
interface CashStatic { | ||
guid: number; | ||
each<T>(arr: ArrayLike<T>, callback: EachArrayCallback<T>): void; | ||
each<T>(obj: PlainObject<T>, callback: EachObjectCallback<T>): void; | ||
} | ||
interface CashStatic { | ||
isWindow(x: any): x is Window; | ||
isFunction(x: any): x is Function; | ||
isNumeric(x: any): boolean; | ||
isArray(x: any): x is Array<any>; | ||
interface Cash { | ||
each(callback: EachArrayCallback<EleLoose>): this; | ||
} | ||
@@ -77,15 +83,14 @@ interface Cash { | ||
interface Cash { | ||
get(): EleLoose[]; | ||
get(index: number): EleLoose | undefined; | ||
removeProp(prop: string): this; | ||
} | ||
interface Cash { | ||
eq(index: number): Cash; | ||
interface CashStatic { | ||
extend(): any; | ||
extend(deep: true, target: any, ...sources: any[]): any; | ||
extend(target: any): typeof cash; | ||
extend(target: any, ...sources: any[]): any; | ||
} | ||
interface Cash { | ||
first(): Cash; | ||
extend(plugins: Record<any, any>): this; | ||
} | ||
interface Cash { | ||
last(): Cash; | ||
} | ||
interface Cash { | ||
filter(comparator?: Comparator): Cash; | ||
@@ -92,0 +97,0 @@ } |
@@ -89,42 +89,2 @@ /* MIT https://github.com/fabiospampinato/cash */ | ||
} | ||
function each(arr, callback, _reverse) { | ||
if (_reverse) { | ||
let i = arr.length; | ||
while (i--) { | ||
if (callback.call(arr[i], i, arr[i]) === false) | ||
return arr; | ||
} | ||
} | ||
else { | ||
for (let i = 0, l = arr.length; i < l; i++) { | ||
if (callback.call(arr[i], i, arr[i]) === false) | ||
return arr; | ||
} | ||
} | ||
return arr; | ||
} | ||
cash.each = each; | ||
fn.each = function (callback) { | ||
return each(this, callback); | ||
}; | ||
fn.removeProp = function (prop) { | ||
return this.each((i, ele) => { delete ele[propMap[prop] || prop]; }); | ||
}; | ||
function extend(target, ...objs) { | ||
const length = arguments.length; | ||
if (!length) | ||
return {}; | ||
if (length === 1) | ||
return extend(cash, target); | ||
for (let i = 1; i < length; i++) { | ||
for (const key in arguments[i]) { | ||
target[key] = arguments[i][key]; | ||
} | ||
} | ||
return target; | ||
} | ||
cash.extend = extend; | ||
fn.extend = function (plugins) { | ||
return extend(fn, plugins); | ||
}; | ||
cash.guid = 1; | ||
@@ -148,2 +108,5 @@ // @require ./cash.ts | ||
} | ||
function isBoolean(x) { | ||
return typeof x === 'boolean'; | ||
} | ||
function isFunction(x) { | ||
@@ -164,6 +127,56 @@ return typeof x === 'function'; | ||
} | ||
function isPlainObject(x) { | ||
if (typeof x !== 'object' || x === null) | ||
return false; | ||
const proto = Object.getPrototypeOf(x); | ||
return proto === null || proto === Object.prototype; | ||
} | ||
cash.isWindow = isWindow; | ||
cash.isFunction = isFunction; | ||
cash.isArray = isArray; | ||
cash.isNumeric = isNumeric; | ||
cash.isArray = isArray; | ||
cash.isPlainObject = isPlainObject; | ||
fn.get = function (index) { | ||
if (isUndefined(index)) | ||
return slice.call(this); | ||
index = Number(index); | ||
return this[index < 0 ? index + this.length : index]; | ||
}; | ||
fn.eq = function (index) { | ||
return cash(this.get(index)); | ||
}; | ||
fn.first = function () { | ||
return this.eq(0); | ||
}; | ||
fn.last = function () { | ||
return this.eq(-1); | ||
}; | ||
function each(arr, callback, _reverse) { | ||
if (_reverse) { | ||
let i = arr.length; | ||
while (i--) { | ||
if (callback.call(arr[i], i, arr[i]) === false) | ||
return arr; | ||
} | ||
} | ||
else if (isPlainObject(arr)) { | ||
const keys = Object.keys(arr); | ||
for (let i = 0, l = keys.length; i < l; i++) { | ||
const key = keys[i]; | ||
if (callback.call(arr[key], key, arr[key]) === false) | ||
return arr; | ||
} | ||
} | ||
else { | ||
for (let i = 0, l = arr.length; i < l; i++) { | ||
if (callback.call(arr[i], i, arr[i]) === false) | ||
return arr; | ||
} | ||
} | ||
return arr; | ||
} | ||
cash.each = each; | ||
fn.each = function (callback) { | ||
return each(this, callback); | ||
}; | ||
fn.prop = function (prop, value) { | ||
@@ -183,17 +196,30 @@ if (!prop) | ||
}; | ||
fn.get = function (index) { | ||
if (isUndefined(index)) | ||
return slice.call(this); | ||
index = Number(index); | ||
return this[index < 0 ? index + this.length : index]; | ||
fn.removeProp = function (prop) { | ||
return this.each((i, ele) => { delete ele[propMap[prop] || prop]; }); | ||
}; | ||
fn.eq = function (index) { | ||
return cash(this.get(index)); | ||
function extend(...sources) { | ||
const deep = isBoolean(sources[0]) ? sources.shift() : false, target = sources.shift(), length = sources.length; | ||
if (!target) | ||
return {}; | ||
if (!length) | ||
return extend(deep, cash, target); | ||
for (let i = 0; i < length; i++) { | ||
const source = sources[i]; | ||
for (const key in source) { | ||
if (deep && (isArray(source[key]) || isPlainObject(source[key]))) { | ||
if (!target[key] || target[key].constructor !== source[key].constructor) | ||
target[key] = new source[key].constructor(); | ||
extend(deep, target[key], source[key]); | ||
} | ||
else { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
} | ||
cash.extend = extend; | ||
fn.extend = function (plugins) { | ||
return extend(fn, plugins); | ||
}; | ||
fn.first = function () { | ||
return this.eq(0); | ||
}; | ||
fn.last = function () { | ||
return this.eq(-1); | ||
}; | ||
// @require ./matches.ts | ||
@@ -200,0 +226,0 @@ // @require ./type_checking.ts |
161
dist/cash.js
@@ -125,56 +125,2 @@ /* MIT https://github.com/fabiospampinato/cash */ | ||
function each(arr, callback, _reverse) { | ||
if (_reverse) { | ||
var i = arr.length; | ||
while (i--) { | ||
if (callback.call(arr[i], i, arr[i]) === false) return arr; | ||
} | ||
} else { | ||
for (var i = 0, l = arr.length; i < l; i++) { | ||
if (callback.call(arr[i], i, arr[i]) === false) return arr; | ||
} | ||
} | ||
return arr; | ||
} | ||
cash.each = each; | ||
fn.each = function (callback) { | ||
return each(this, callback); | ||
}; | ||
fn.removeProp = function (prop) { | ||
return this.each(function (i, ele) { | ||
delete ele[propMap[prop] || prop]; | ||
}); | ||
}; | ||
function extend(target) { | ||
var objs = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
objs[_i - 1] = arguments[_i]; | ||
} | ||
var length = arguments.length; | ||
if (!length) return {}; | ||
if (length === 1) return extend(cash, target); | ||
for (var i = 1; i < length; i++) { | ||
for (var key in arguments[i]) { | ||
target[key] = arguments[i][key]; | ||
} | ||
} | ||
return target; | ||
} | ||
cash.extend = extend; | ||
fn.extend = function (plugins) { | ||
return extend(fn, plugins); | ||
}; | ||
cash.guid = 1; // @require ./cash.ts | ||
@@ -203,2 +149,6 @@ | ||
function isBoolean(x) { | ||
return typeof x === 'boolean'; | ||
} | ||
function isFunction(x) { | ||
@@ -224,7 +174,61 @@ return typeof x === 'function'; | ||
function isPlainObject(x) { | ||
if (typeof x !== 'object' || x === null) return false; | ||
var proto = Object.getPrototypeOf(x); | ||
return proto === null || proto === Object.prototype; | ||
} | ||
cash.isWindow = isWindow; | ||
cash.isFunction = isFunction; | ||
cash.isArray = isArray; | ||
cash.isNumeric = isNumeric; | ||
cash.isArray = isArray; | ||
cash.isPlainObject = isPlainObject; | ||
fn.get = function (index) { | ||
if (isUndefined(index)) return slice.call(this); | ||
index = Number(index); | ||
return this[index < 0 ? index + this.length : index]; | ||
}; | ||
fn.eq = function (index) { | ||
return cash(this.get(index)); | ||
}; | ||
fn.first = function () { | ||
return this.eq(0); | ||
}; | ||
fn.last = function () { | ||
return this.eq(-1); | ||
}; | ||
function each(arr, callback, _reverse) { | ||
if (_reverse) { | ||
var i = arr.length; | ||
while (i--) { | ||
if (callback.call(arr[i], i, arr[i]) === false) return arr; | ||
} | ||
} else if (isPlainObject(arr)) { | ||
var keys = Object.keys(arr); | ||
for (var i = 0, l = keys.length; i < l; i++) { | ||
var key = keys[i]; | ||
if (callback.call(arr[key], key, arr[key]) === false) return arr; | ||
} | ||
} else { | ||
for (var i = 0, l = arr.length; i < l; i++) { | ||
if (callback.call(arr[i], i, arr[i]) === false) return arr; | ||
} | ||
} | ||
return arr; | ||
} | ||
cash.each = each; | ||
fn.each = function (callback) { | ||
return each(this, callback); | ||
}; | ||
fn.prop = function (prop, value) { | ||
@@ -248,18 +252,41 @@ if (!prop) return; | ||
fn.get = function (index) { | ||
if (isUndefined(index)) return slice.call(this); | ||
index = Number(index); | ||
return this[index < 0 ? index + this.length : index]; | ||
fn.removeProp = function (prop) { | ||
return this.each(function (i, ele) { | ||
delete ele[propMap[prop] || prop]; | ||
}); | ||
}; | ||
fn.eq = function (index) { | ||
return cash(this.get(index)); | ||
}; | ||
function extend() { | ||
var sources = []; | ||
fn.first = function () { | ||
return this.eq(0); | ||
}; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
sources[_i] = arguments[_i]; | ||
} | ||
fn.last = function () { | ||
return this.eq(-1); | ||
var deep = isBoolean(sources[0]) ? sources.shift() : false, | ||
target = sources.shift(), | ||
length = sources.length; | ||
if (!target) return {}; | ||
if (!length) return extend(deep, cash, target); | ||
for (var i = 0; i < length; i++) { | ||
var source = sources[i]; | ||
for (var key in source) { | ||
if (deep && (isArray(source[key]) || isPlainObject(source[key]))) { | ||
if (!target[key] || target[key].constructor !== source[key].constructor) target[key] = new source[key].constructor(); | ||
extend(deep, target[key], source[key]); | ||
} else { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
} | ||
cash.extend = extend; | ||
fn.extend = function (plugins) { | ||
return extend(fn, plugins); | ||
}; // @require ./matches.ts | ||
@@ -266,0 +293,0 @@ // @require ./type_checking.ts |
/* MIT https://github.com/fabiospampinato/cash */ | ||
(function(){ | ||
'use strict';var e={"class":"className",contenteditable:"contentEditable","for":"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function g(a,b){try{return a(b)}catch(c){return b}} | ||
var m=document,n=window,p=m.documentElement,t=m.createElement.bind(m),aa=t("div"),u=t("table"),ba=t("tbody"),ca=t("tr"),v=Array.isArray,w=Array.prototype,da=w.concat,x=w.filter,ea=w.indexOf,fa=w.map,ha=w.push,ia=w.slice,y=w.some,ja=w.splice,ka=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,la=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,ma=/<.+>/,na=/^\w+$/;function z(a,b){return a&&(A(b)||B(b))?la.test(a)?b.getElementsByClassName(a.slice(1)):na.test(a)?b.getElementsByTagName(a):b.querySelectorAll(a):[]} | ||
var C=function(){function a(a,c){if(a){if(a instanceof C)return a;var b=a;if(D(a)){if(b=(c instanceof C?c[0]:c)||m,b=ka.test(a)?b.getElementById(a.slice(1)):ma.test(a)?oa(a):z(a,b),!b)return}else if(E(a))return this.ready(a);if(b.nodeType||b===n)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}(),F=C.prototype,G=F.init;G.fn=G.prototype=F;F.length=0;F.splice=ja;"function"===typeof Symbol&&(F[Symbol.iterator]=w[Symbol.iterator]); | ||
F.map=function(a){return G(da.apply([],fa.call(this,function(b,c){return a.call(b,c,b)})))};F.slice=function(a,b){return G(ia.call(this,a,b))};var pa=/-([a-z])/g;function H(a){return a.replace(pa,function(a,c){return c.toUpperCase()})}function I(a,b,c){if(c)for(c=a.length;c--&&!1!==b.call(a[c],c,a[c]););else{c=0;for(var d=a.length;c<d&&!1!==b.call(a[c],c,a[c]);c++);}return a}G.each=I;F.each=function(a){return I(this,a)};F.removeProp=function(a){return this.each(function(b,c){delete c[e[a]||a]})}; | ||
function J(a){for(var b=1;b<arguments.length;b++);b=arguments.length;if(!b)return{};if(1===b)return J(G,a);for(var c=1;c<b;c++)for(var d in arguments[c])a[d]=arguments[c][d];return a}G.extend=J;F.extend=function(a){return J(F,a)};G.guid=1;function qa(a,b){var c=a&&(a.matches||a.webkitMatchesSelector||a.msMatchesSelector);return!!c&&!!b&&c.call(a,b)}function K(a){return!!a&&a===a.window}function A(a){return!!a&&9===a.nodeType}function B(a){return!!a&&1===a.nodeType} | ||
function E(a){return"function"===typeof a}function D(a){return"string"===typeof a}function ra(a){return!isNaN(parseFloat(a))&&isFinite(a)}G.isWindow=K;G.isFunction=E;G.isNumeric=ra;G.isArray=v;F.prop=function(a,b){if(a){if(D(a))return a=e[a]||a,2>arguments.length?this[0]&&this[0][a]:this.each(function(c,h){h[a]=b});for(var c in a)this.prop(c,a[c]);return this}};F.get=function(a){if(void 0===a)return ia.call(this);a=Number(a);return this[0>a?a+this.length:a]};F.eq=function(a){return G(this.get(a))}; | ||
F.first=function(){return this.eq(0)};F.last=function(){return this.eq(-1)};function L(a){return D(a)?function(b,c){return qa(c,a)}:E(a)?a:a instanceof C?function(b,c){return a.is(c)}:a?function(b,c){return c===a}:function(){return!1}}F.filter=function(a){var b=L(a);return G(x.call(this,function(a,d){return b.call(a,d,a)}))};function M(a,b){return b?a.filter(b):a}var sa=/\S+/g;function N(a){return D(a)?a.match(sa)||[]:[]}F.hasClass=function(a){return!!a&&y.call(this,function(b){return B(b)&&b.classList.contains(a)})}; | ||
F.removeAttr=function(a){var b=N(a);return this.each(function(a,d){B(d)&&I(b,function(a,b){d.removeAttribute(b)})})};F.attr=function(a,b){if(a){if(D(a)){if(2>arguments.length){if(!this[0]||!B(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,h){B(h)&&h.setAttribute(a,b)})}for(c in a)this.attr(c,a[c]);return this}}; | ||
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),q=d&&L(d),r=0,k=a.length;r<k;r++)if(f){var l=b(a[r]);l.length&&ha.apply(h,l)}else for(l=a[r][b];!(null==l||d&&q(-1,l));)h.push(l),l=c?l[b]:null;return h}function P(a){return 1<a.length?x.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)){var d=n.getComputedStyle(a,null);return c?d.getPropertyValue(b)||void 0:d[b]||a.style[b]}} | ||
function R(a,b){return parseInt(Q(a,b),10)||0}var S=/^--/,T={},ta=aa.style,ua=["webkit","moz","ms"];function va(a,b){void 0===b&&(b=S.test(a));if(b)return a;if(!T[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 T[a]=c,!1})}return T[a]} | ||
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=S.test(a));return c||wa[a]||!ra(b)?b:b+"px"} | ||
F.css=function(a,b){if(D(a)){var c=S.test(a);a=va(a,c);if(2>arguments.length)return this[0]&&Q(this[0],a,c);if(!a)return this;b=xa(a,b,c);return this.each(function(d,f){B(f)&&(c?f.style.setProperty(a,b):f.style[a]=b)})}for(var d in a)this.css(d,a[d]);return this};var ya=/^\s+|\s+$/;function za(a,b){a=a.dataset[b]||a.dataset[H(b)];return ya.test(a)?a:g(JSON.parse,a)} | ||
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)}})}); | ||
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 U={}; | ||
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(U[c])c=U[c];else{var d=t(c);m.body.insertBefore(d,null);var h=Q(d,"display");m.body.removeChild(d);c=U[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||!y.call(b,function(b){return 0>a.indexOf(b)})}var V={focus:"focusin",blur:"focusout"},W={mouseenter:"mouseover",mouseleave:"mouseout"},Da=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Ea(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 q=f[0],k=f[1];f=f[2];if(h&&f.guid!==h.guid||!Ca(q,c)||d&&d!==k)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(h);h=a[0];var f=a[1],k=W[h]||V[h]||h;d.each(function(a,d){(B(d)||A(d)||K(d))&&Y(d,k,f,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 q in a)this.on(q,b,c,a[q],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(k);k=a[0];var q=a[1],r=W[k]||V[k]||k,Ia=k in W,Ja=k in V;r&&f.each(function(a,f){if(B(f)||A(f)||K(f))a=function Ka(a){if(a.target["___i"+a.type])return a.stopImmediatePropagation();if(!a.namespace||Ca(q,a.namespace.split(".")))if(b||!(Ja&&(a.target!==f||a.___ot===r)||Ia&&a.relatedTarget&& | ||
f.contains(a.relatedTarget))){var k=f;if(b){for(var l=a.target;!qa(l,b);){if(l===f)return;l=l.parentNode;if(!l)return}k=l;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}});l=d.call(k,a,a.___td);h&&Y(f,r,q,b,Ka);!1===l&&(a.preventDefault(),a.stopPropagation())}},a.guid=d.guid=d.guid||G.guid++,Ea(f,r,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];var h=W[d]||V[d]||d;if(!h)return this;var f=Da.test(h)?"MouseEvents":"HTMLEvents";a=m.createEvent(f);a.initEvent(h,!0,!0);a.namespace=c.join(".");a.___ot=d}a.___td=b;var q=a.___ot in V;return this.each(function(b,c){q&&E(c[a.___ot])&&(c["___i"+a.type]=!0,c[a.___ot](),c["___i"+a.type]=!1);c.dispatchEvent(a)})}; | ||
function Fa(a){return a.multiple&&a.options?O(x.call(a.options,function(a){return a.selected&&!a.disabled&&!a.parentNode.disabled}),"value"):a.value||""}var Ga=/%20/g,Ha=/\r?\n/g,La=/file|reset|submit|button|image/i,Ma=/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||La.test(c.type)||Ma.test(c.type)&&!c.checked||(b=Fa(c),void 0!==b&&(b=v(b)?b:[b],I(b,function(b,d){b=a;d="&"+encodeURIComponent(c.name)+"="+encodeURIComponent(d.replace(Ha,"\r\n")).replace(Ga,"+");a=b+d})))})});return a.slice(1)}; | ||
F.val=function(a){return arguments.length?this.each(function(b,c){if((b=c.multiple&&c.options)||Ma.test(c.type)){var d=v(a)?fa.call(a,String):null===a?[]:[String(a)];b?I(c.options,function(a,b){b.selected=0<=d.indexOf(b.value)},!0):c.checked=0<=d.indexOf(c.value)}else c.value=void 0===a||null===a?"":a}):this[0]&&Fa(this[0])};F.clone=function(){return this.map(function(a,b){return b.cloneNode(!0)})};F.detach=function(a){M(this,a).each(function(a,c){c.parentNode&&c.parentNode.removeChild(c)});return this}; | ||
var Na=/^\s*<(\w+)[^>]*>/,Oa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Pa={"*":aa,tr:ba,td:ca,th:ca,thead:u,tbody:u,tfoot:u};function oa(a){if(!D(a))return[];if(Oa.test(a))return[t(RegExp.$1)];var b=Na.test(a)&&RegExp.$1;b=Pa[b]||Pa["*"];b.innerHTML=a;return G(b.childNodes).detach().get()}G.parseHTML=oa;F.empty=function(){return this.each(function(a,b){for(;b.firstChild;)b.removeChild(b.firstChild)})}; | ||
F.html=function(a){return arguments.length?void 0===a?this:this.each(function(b,c){B(c)&&(c.innerHTML=a)}):this[0]&&this[0].innerHTML};F.remove=function(a){M(this,a).detach().off();return this};F.text=function(a){return void 0===a?this[0]?this[0].textContent:"":this.each(function(b,c){B(c)&&(c.textContent=a)})};F.unwrap=function(){this.parent().each(function(a,b){"BODY"!==b.tagName&&(a=G(b),a.replaceWith(a.children()))});return this}; | ||
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.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 z(a,b)})))};var Qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ra=/^$|^module$|\/(java|ecma)script/i,Sa=["type","src","nonce","noModule"]; | ||
function Ta(a,b){a=G(a);a.filter("script").add(a.find("script")).each(function(a,d){if(Ra.test(d.type)&&p.contains(d)){var c=t("script");c.text=d.textContent.replace(Qa,"");I(Sa,function(a,b){d[b]&&(c[b]=d[b])});b.head.insertBefore(c,null);b.head.removeChild(c)}})} | ||
function Z(a,b,c,d,h,f,q,r){I(a,function(a,f){I(G(f),function(a,f){I(G(b),function(b,k){var l=c?k:f;b=c?a:b;k=c?f:k;l=b?l.cloneNode(!0):l;b=!b;h?k.insertBefore(l,d?k.firstChild:null):k.parentNode.insertBefore(l,d?k:k.nextSibling);b&&Ta(l,k.ownerDocument)},r)},q)},f);return b}F.after=function(){return Z(arguments,this,!1,!1,!1,!0,!0)};F.append=function(){return Z(arguments,this,!1,!1,!0)};F.appendTo=function(a){return Z(arguments,this,!0,!1,!0)};F.before=function(){return Z(arguments,this,!1,!0)}; | ||
F.insertAfter=function(a){return Z(arguments,this,!0,!1,!1,!1,!1,!0)};F.insertBefore=function(a){return Z(arguments,this,!0,!0)};F.prepend=function(){return Z(arguments,this,!1,!0,!0,!0,!0)};F.prependTo=function(a){return Z(arguments,this,!0,!0,!0,!1,!1,!0)};F.replaceWith=function(a){return this.before(a).remove()};F.replaceAll=function(a){G(a).replaceWith(this);return this};F.wrapAll=function(a){a=G(a);for(var b=a[0];b.children.length;)b=b.firstElementChild;this.first().before(a);return this.appendTo(b)}; | ||
F.wrap=function(a){return this.each(function(b,c){var d=G(a)[0];G(c).wrapAll(b?d.cloneNode(!0):d)})};F.wrapInner=function(a){return this.each(function(b,c){b=G(c);c=b.contents();c.length?c.wrapAll(a):b.append(a)})};F.has=function(a){var b=D(a)?function(b,d){return z(a,d).length}:function(b,d){return d.contains(a)};return this.filter(b)};F.is=function(a){var b=L(a);return y.call(this,function(a,d){return b.call(a,d,a)})};F.next=function(a,b,c){return M(G(P(O(this,"nextElementSibling",b,c))),a)}; | ||
F.nextAll=function(a){return this.next(a,!0)};F.nextUntil=function(a,b){return this.next(b,!0,a)};F.not=function(a){var b=L(a);return this.filter(function(c,d){return(!D(a)||B(d))&&!b.call(d,c,d)})};F.parent=function(a){return M(G(P(O(this,"parentNode"))),a)};F.index=function(a){var b=a?G(a)[0]:this[0];a=a?this:G(b).parent().children();return ea.call(a,b)};F.closest=function(a){var b=this.filter(a);if(b.length)return b;var c=this.parent();return c.length?c.closest(a):b}; | ||
F.parents=function(a,b){return M(G(P(O(this,"parentElement",!0,b))),a)};F.parentsUntil=function(a,b){return this.parents(b,a)};F.prev=function(a,b,c){return M(G(P(O(this,"previousElementSibling",b,c))),a)};F.prevAll=function(a){return this.prev(a,!0)};F.prevUntil=function(a,b){return this.prev(b,!0,a)};F.siblings=function(a){return M(G(P(O(this,function(a){return G(a).parent().children().not(a)}))),a)};"undefined"!==typeof exports?module.exports=G:n.cash=n.$=G; | ||
'use strict';var e={"class":"className",contenteditable:"contentEditable","for":"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};function aa(a,b){try{return a(b)}catch(c){return b}} | ||
var k=document,m=window,ba=k.documentElement,n=k.createElement.bind(k),ca=n("div"),p=n("table"),da=n("tbody"),ea=n("tr"),q=Array.isArray,r=Array.prototype,fa=r.concat,t=r.filter,ha=r.indexOf,ia=r.map,ja=r.push,ka=r.slice,u=r.some,la=r.splice,ma=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,na=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,oa=/<.+>/,pa=/^\w+$/;function v(a,b){return a&&(w(b)||x(b))?na.test(a)?b.getElementsByClassName(a.slice(1)):pa.test(a)?b.getElementsByTagName(a):b.querySelectorAll(a):[]} | ||
var B=function(){function a(a,c){if(a){if(a instanceof B)return a;var b=a;if(C(a)){if(b=(c instanceof B?c[0]:c)||k,b=ma.test(a)?b.getElementById(a.slice(1)):oa.test(a)?qa(a):v(a,b),!b)return}else if(D(a))return this.ready(a);if(b.nodeType||b===m)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}(),E=B.prototype,F=E.init;F.fn=F.prototype=E;E.length=0;E.splice=la;"function"===typeof Symbol&&(E[Symbol.iterator]=r[Symbol.iterator]); | ||
E.map=function(a){return F(fa.apply([],ia.call(this,function(b,c){return a.call(b,c,b)})))};E.slice=function(a,b){return F(ka.call(this,a,b))};var ra=/-([a-z])/g;function G(a){return a.replace(ra,function(a,c){return c.toUpperCase()})}F.guid=1;function sa(a,b){var c=a&&(a.matches||a.webkitMatchesSelector||a.msMatchesSelector);return!!c&&!!b&&c.call(a,b)}function H(a){return!!a&&a===a.window}function w(a){return!!a&&9===a.nodeType}function x(a){return!!a&&1===a.nodeType} | ||
function D(a){return"function"===typeof a}function C(a){return"string"===typeof a}function ta(a){return!isNaN(parseFloat(a))&&isFinite(a)}function I(a){if("object"!==typeof a||null===a)return!1;a=Object.getPrototypeOf(a);return null===a||a===Object.prototype}F.isWindow=H;F.isFunction=D;F.isArray=q;F.isNumeric=ta;F.isPlainObject=I;E.get=function(a){if(void 0===a)return ka.call(this);a=Number(a);return this[0>a?a+this.length:a]};E.eq=function(a){return F(this.get(a))};E.first=function(){return this.eq(0)}; | ||
E.last=function(){return this.eq(-1)};function J(a,b,c){if(c)for(c=a.length;c--&&!1!==b.call(a[c],c,a[c]););else if(I(a)){var d=Object.keys(a);c=0;for(var h=d.length;c<h;c++){var f=d[c];if(!1===b.call(a[f],f,a[f]))break}}else for(c=0,h=a.length;c<h&&!1!==b.call(a[c],c,a[c]);c++);return a}F.each=J;E.each=function(a){return J(this,a)};E.prop=function(a,b){if(a){if(C(a))return a=e[a]||a,2>arguments.length?this[0]&&this[0][a]:this.each(function(c,h){h[a]=b});for(var c in a)this.prop(c,a[c]);return this}}; | ||
E.removeProp=function(a){return this.each(function(b,c){delete c[e[a]||a]})};function K(){for(var a=[],b=0;b<arguments.length;b++)a[b]=arguments[b];b="boolean"===typeof a[0]?a.shift():!1;var c=a.shift(),d=a.length;if(!c)return{};if(!d)return K(b,F,c);for(var h=0;h<d;h++){var f=a[h],g;for(g in f)b&&(q(f[g])||I(f[g]))?(c[g]&&c[g].constructor===f[g].constructor||(c[g]=new f[g].constructor),K(b,c[g],f[g])):c[g]=f[g]}return c}F.extend=K;E.extend=function(a){return K(E,a)}; | ||
function L(a){return C(a)?function(b,c){return sa(c,a)}:D(a)?a:a instanceof B?function(b,c){return a.is(c)}:a?function(b,c){return c===a}:function(){return!1}}E.filter=function(a){var b=L(a);return F(t.call(this,function(a,d){return b.call(a,d,a)}))};function M(a,b){return b?a.filter(b):a}var ua=/\S+/g;function N(a){return C(a)?a.match(ua)||[]:[]}E.hasClass=function(a){return!!a&&u.call(this,function(b){return x(b)&&b.classList.contains(a)})}; | ||
E.removeAttr=function(a){var b=N(a);return this.each(function(a,d){x(d)&&J(b,function(a,b){d.removeAttribute(b)})})};E.attr=function(a,b){if(a){if(C(a)){if(2>arguments.length){if(!this[0]||!x(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,h){x(h)&&h.setAttribute(a,b)})}for(c in a)this.attr(c,a[c]);return this}}; | ||
E.toggleClass=function(a,b){var c=N(a),d=void 0!==b;return this.each(function(a,f){x(f)&&J(c,function(a,c){d?b?f.classList.add(c):f.classList.remove(c):f.classList.toggle(c)})})};E.addClass=function(a){return this.toggleClass(a,!0)};E.removeClass=function(a){return arguments.length?this.toggleClass(a,!1):this.attr("class","")}; | ||
function O(a,b,c,d){for(var h=[],f=D(b),g=d&&L(d),y=0,z=a.length;y<z;y++)if(f){var l=b(a[y]);l.length&&ja.apply(h,l)}else for(l=a[y][b];!(null==l||d&&g(-1,l));)h.push(l),l=c?l[b]:null;return h}function P(a){return 1<a.length?t.call(a,function(a,c,d){return ha.call(d,a)===c}):a}F.unique=P;E.add=function(a,b){return F(P(this.get().concat(F(a,b).get())))};function Q(a,b,c){if(x(a)){var d=m.getComputedStyle(a,null);return c?d.getPropertyValue(b)||void 0:d[b]||a.style[b]}} | ||
function R(a,b){return parseInt(Q(a,b),10)||0}var S=/^--/,T={},va=ca.style,wa=["webkit","moz","ms"];function xa(a,b){void 0===b&&(b=S.test(a));if(b)return a;if(!T[a]){b=G(a);var c=""+b[0].toUpperCase()+b.slice(1);b=(b+" "+wa.join(c+" ")+c).split(" ");J(b,function(b,c){if(c in va)return T[a]=c,!1})}return T[a]} | ||
var ya={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 za(a,b,c){void 0===c&&(c=S.test(a));return c||ya[a]||!ta(b)?b:b+"px"} | ||
E.css=function(a,b){if(C(a)){var c=S.test(a);a=xa(a,c);if(2>arguments.length)return this[0]&&Q(this[0],a,c);if(!a)return this;b=za(a,b,c);return this.each(function(d,f){x(f)&&(c?f.style.setProperty(a,b):f.style[a]=b)})}for(var d in a)this.css(d,a[d]);return this};var Aa=/^\s+|\s+$/;function Ba(a,b){a=a.dataset[b]||a.dataset[G(b)];return Aa.test(a)?a:aa(JSON.parse,a)} | ||
E.data=function(a,b){if(!a){if(!this[0])return;var c={},d;for(d in this[0].dataset)c[d]=Ba(this[0],d);return c}if(C(a))return 2>arguments.length?this[0]&&Ba(this[0],a):void 0===b?this:this.each(function(c,d){c=b;c=aa(JSON.stringify,c);d.dataset[G(a)]=c});for(d in a)this.data(d,a[d]);return this};function Ca(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 Da(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")} | ||
J([!0,!1],function(a,b){J(["Width","Height"],function(a,d){E[(b?"outer":"inner")+d]=function(c){if(this[0])return H(this[0])?b?this[0]["inner"+d]:this[0].document.documentElement["client"+d]:w(this[0])?Ca(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)}})}); | ||
J(["Width","Height"],function(a,b){var c=b.toLowerCase();E[c]=function(d){if(!this[0])return void 0===d?void 0:this;if(!arguments.length)return H(this[0])?this[0].document.documentElement["client"+b]:w(this[0])?Ca(this[0],b):this[0].getBoundingClientRect()[c]-Da(this[0],!a);var h=parseInt(d,10);return this.each(function(b,d){x(d)&&(b=Q(d,"boxSizing"),d.style[c]=za(c,h+("border-box"===b?Da(d,!a):0)))})}});var U={}; | ||
E.toggle=function(a){return this.each(function(b,c){if(x(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(U[c])c=U[c];else{var d=n(c);k.body.insertBefore(d,null);var h=Q(d,"display");k.body.removeChild(d);c=U[c]="none"!==h?h:"block"}b.display=c}}else c.___cd=Q(c,"display"),c.style.display="none"})};E.hide=function(){return this.toggle(!1)};E.show=function(){return this.toggle(!0)}; | ||
function Ea(a,b){return!b||!u.call(b,function(b){return 0>a.indexOf(b)})}var V={focus:"focusin",blur:"focusout"},W={mouseenter:"mouseover",mouseleave:"mouseout"},Fa=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Ga(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 g=f[0],z=f[1];f=f[2];if(h&&f.guid!==h.guid||!Ea(g,c)||d&&d!==z)return!0;a.removeEventListener(b,f)}));else for(b in f)Y(a,b,c,d,h)} | ||
E.off=function(a,b,c){var d=this;if(void 0===a)this.each(function(a,b){(x(b)||w(b)||H(b))&&Y(b)});else if(C(a))D(b)&&(c=b,b=""),J(N(a),function(a,h){a=X(h);h=a[0];var f=a[1],g=W[h]||V[h]||h;d.each(function(a,d){(x(d)||w(d)||H(d))&&Y(d,g,f,b,c)})});else for(var h in a)this.off(h,a[h]);return this}; | ||
E.on=function(a,b,c,d,h){var f=this;if(!C(a)){for(var g in a)this.on(g,b,c,a[g],h);return this}C(b)||(void 0!==b&&null!==b&&(void 0!==c&&(d=c),c=b),b="");D(d)||(d=c,c=void 0);if(!d)return this;J(N(a),function(a,g){a=X(g);g=a[0];var l=a[1],z=W[g]||V[g]||g,y=g in W,Ka=g in V;z&&f.each(function(a,f){if(x(f)||w(f)||H(f))a=function La(a){if(a.target["___i"+a.type])return a.stopImmediatePropagation();if(!a.namespace||Ea(l,a.namespace.split(".")))if(b||!(Ka&&(a.target!==f||a.___ot===z)||y&&a.relatedTarget&& | ||
f.contains(a.relatedTarget))){var g=f;if(b){for(var A=a.target;!sa(A,b);){if(A===f)return;A=A.parentNode;if(!A)return}g=A;a.___cd=!0}a.___cd&&Object.defineProperty(a,"currentTarget",{configurable:!0,get:function(){return g}});Object.defineProperty(a,"data",{configurable:!0,get:function(){return c}});A=d.call(g,a,a.___td);h&&Y(f,z,l,b,La);!1===A&&(a.preventDefault(),a.stopPropagation())}},a.guid=d.guid=d.guid||F.guid++,Ga(f,z,l,b,a)})});return this};E.one=function(a,b,c,d){return this.on(a,b,c,d,!0)}; | ||
E.ready=function(a){function b(){return setTimeout(a,0,F)}"loading"!==k.readyState?b():k.addEventListener("DOMContentLoaded",b);return this};E.trigger=function(a,b){if(C(a)){var c=X(a),d=c[0];c=c[1];var h=W[d]||V[d]||d;if(!h)return this;var f=Fa.test(h)?"MouseEvents":"HTMLEvents";a=k.createEvent(f);a.initEvent(h,!0,!0);a.namespace=c.join(".");a.___ot=d}a.___td=b;var g=a.___ot in V;return this.each(function(b,c){g&&D(c[a.___ot])&&(c["___i"+a.type]=!0,c[a.___ot](),c["___i"+a.type]=!1);c.dispatchEvent(a)})}; | ||
function Ha(a){return a.multiple&&a.options?O(t.call(a.options,function(a){return a.selected&&!a.disabled&&!a.parentNode.disabled}),"value"):a.value||""}var Ia=/%20/g,Ja=/\r?\n/g,Ma=/file|reset|submit|button|image/i,Na=/radio|checkbox/i; | ||
E.serialize=function(){var a="";this.each(function(b,c){J(c.elements||[c],function(b,c){c.disabled||!c.name||"FIELDSET"===c.tagName||Ma.test(c.type)||Na.test(c.type)&&!c.checked||(b=Ha(c),void 0!==b&&(b=q(b)?b:[b],J(b,function(b,d){b=a;d="&"+encodeURIComponent(c.name)+"="+encodeURIComponent(d.replace(Ja,"\r\n")).replace(Ia,"+");a=b+d})))})});return a.slice(1)}; | ||
E.val=function(a){return arguments.length?this.each(function(b,c){if((b=c.multiple&&c.options)||Na.test(c.type)){var d=q(a)?ia.call(a,String):null===a?[]:[String(a)];b?J(c.options,function(a,b){b.selected=0<=d.indexOf(b.value)},!0):c.checked=0<=d.indexOf(c.value)}else c.value=void 0===a||null===a?"":a}):this[0]&&Ha(this[0])};E.clone=function(){return this.map(function(a,b){return b.cloneNode(!0)})};E.detach=function(a){M(this,a).each(function(a,c){c.parentNode&&c.parentNode.removeChild(c)});return this}; | ||
var Oa=/^\s*<(\w+)[^>]*>/,Pa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,Qa={"*":ca,tr:da,td:ea,th:ea,thead:p,tbody:p,tfoot:p};function qa(a){if(!C(a))return[];if(Pa.test(a))return[n(RegExp.$1)];var b=Oa.test(a)&&RegExp.$1;b=Qa[b]||Qa["*"];b.innerHTML=a;return F(b.childNodes).detach().get()}F.parseHTML=qa;E.empty=function(){return this.each(function(a,b){for(;b.firstChild;)b.removeChild(b.firstChild)})}; | ||
E.html=function(a){return arguments.length?void 0===a?this:this.each(function(b,c){x(c)&&(c.innerHTML=a)}):this[0]&&this[0].innerHTML};E.remove=function(a){M(this,a).detach().off();return this};E.text=function(a){return void 0===a?this[0]?this[0].textContent:"":this.each(function(b,c){x(c)&&(c.textContent=a)})};E.unwrap=function(){this.parent().each(function(a,b){"BODY"!==b.tagName&&(a=F(b),a.replaceWith(a.children()))});return this}; | ||
E.offset=function(){var a=this[0];if(a)return a=a.getBoundingClientRect(),{top:a.top+m.pageYOffset,left:a.left+m.pageXOffset}};E.offsetParent=function(){return this.map(function(a,b){for(a=b.offsetParent;a&&"static"===Q(a,"position");)a=a.offsetParent;return a||ba})}; | ||
E.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&&x(b)&&(d=F(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")}}}; | ||
E.children=function(a){return M(F(P(O(this,function(a){return a.children}))),a)};E.contents=function(){return F(P(O(this,function(a){return"IFRAME"===a.tagName?[a.contentDocument]:"TEMPLATE"===a.tagName?a.content.childNodes:a.childNodes})))};E.find=function(a){return F(P(O(this,function(b){return v(a,b)})))};var Ra=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Sa=/^$|^module$|\/(java|ecma)script/i,Ta=["type","src","nonce","noModule"]; | ||
function Ua(a,b){a=F(a);a.filter("script").add(a.find("script")).each(function(a,d){if(Sa.test(d.type)&&ba.contains(d)){var c=n("script");c.text=d.textContent.replace(Ra,"");J(Ta,function(a,b){d[b]&&(c[b]=d[b])});b.head.insertBefore(c,null);b.head.removeChild(c)}})} | ||
function Z(a,b,c,d,h,f,g,y){J(a,function(a,f){J(F(f),function(a,f){J(F(b),function(b,g){var l=c?g:f;b=c?a:b;g=c?f:g;l=b?l.cloneNode(!0):l;b=!b;h?g.insertBefore(l,d?g.firstChild:null):g.parentNode.insertBefore(l,d?g:g.nextSibling);b&&Ua(l,g.ownerDocument)},y)},g)},f);return b}E.after=function(){return Z(arguments,this,!1,!1,!1,!0,!0)};E.append=function(){return Z(arguments,this,!1,!1,!0)};E.appendTo=function(a){return Z(arguments,this,!0,!1,!0)};E.before=function(){return Z(arguments,this,!1,!0)}; | ||
E.insertAfter=function(a){return Z(arguments,this,!0,!1,!1,!1,!1,!0)};E.insertBefore=function(a){return Z(arguments,this,!0,!0)};E.prepend=function(){return Z(arguments,this,!1,!0,!0,!0,!0)};E.prependTo=function(a){return Z(arguments,this,!0,!0,!0,!1,!1,!0)};E.replaceWith=function(a){return this.before(a).remove()};E.replaceAll=function(a){F(a).replaceWith(this);return this};E.wrapAll=function(a){a=F(a);for(var b=a[0];b.children.length;)b=b.firstElementChild;this.first().before(a);return this.appendTo(b)}; | ||
E.wrap=function(a){return this.each(function(b,c){var d=F(a)[0];F(c).wrapAll(b?d.cloneNode(!0):d)})};E.wrapInner=function(a){return this.each(function(b,c){b=F(c);c=b.contents();c.length?c.wrapAll(a):b.append(a)})};E.has=function(a){var b=C(a)?function(b,d){return v(a,d).length}:function(b,d){return d.contains(a)};return this.filter(b)};E.is=function(a){var b=L(a);return u.call(this,function(a,d){return b.call(a,d,a)})};E.next=function(a,b,c){return M(F(P(O(this,"nextElementSibling",b,c))),a)}; | ||
E.nextAll=function(a){return this.next(a,!0)};E.nextUntil=function(a,b){return this.next(b,!0,a)};E.not=function(a){var b=L(a);return this.filter(function(c,d){return(!C(a)||x(d))&&!b.call(d,c,d)})};E.parent=function(a){return M(F(P(O(this,"parentNode"))),a)};E.index=function(a){var b=a?F(a)[0]:this[0];a=a?this:F(b).parent().children();return ha.call(a,b)};E.closest=function(a){var b=this.filter(a);if(b.length)return b;var c=this.parent();return c.length?c.closest(a):b}; | ||
E.parents=function(a,b){return M(F(P(O(this,"parentElement",!0,b))),a)};E.parentsUntil=function(a,b){return this.parents(b,a)};E.prev=function(a,b,c){return M(F(P(O(this,"previousElementSibling",b,c))),a)};E.prevAll=function(a){return this.prev(a,!0)};E.prevUntil=function(a,b){return this.prev(b,!0,a)};E.siblings=function(a){return M(F(P(O(this,function(a){return F(a).parent().children().not(a)}))),a)};"undefined"!==typeof exports?module.exports=F:m.cash=m.$=F; | ||
})(); |
303
dist/cash.ts
@@ -65,2 +65,4 @@ | ||
type PlainObject<T> = Record<string, T>; //FIXME: Arrays can be assigned to this type, for whatever reason | ||
type EventCallback = { | ||
@@ -211,199 +213,238 @@ ( event: any, data?: any ): any, | ||
type EachCallback<T> = ( this: T, index: number, ele: T ) => any; | ||
interface CashStatic { | ||
each<T> ( arr: ArrayLike<T>, callback: EachCallback<T> ): void; | ||
guid: number; | ||
} | ||
function each<T, U extends ArrayLike<T> = ArrayLike<T>> ( arr: U, callback: EachCallback<U[0]>, _reverse?: boolean ): U { | ||
cash.guid = 1; | ||
if ( _reverse ) { | ||
let i = arr.length; | ||
// @require ./cash.ts | ||
while ( i-- ) { | ||
function matches ( ele: any, selector: string ): boolean { | ||
if ( callback.call ( arr[i], i, arr[i] ) === false ) return arr; | ||
const matches = ele && ( ele['matches'] || ele['webkitMatchesSelector'] || ele['msMatchesSelector'] ); | ||
} | ||
return !!matches && !!selector && matches.call ( ele, selector ); | ||
} else { | ||
} | ||
for ( let i = 0, l = arr.length; i < l; i++ ) { | ||
if ( callback.call ( arr[i], i, arr[i] ) === false ) return arr; | ||
// @require ./cash.ts | ||
// @require ./variables.ts | ||
} | ||
interface CashStatic { | ||
isWindow ( x: any ): x is Window; | ||
isFunction ( x: any ): x is Function; | ||
isArray ( x: any ): x is Array<any>; | ||
isNumeric ( x: any ): boolean; | ||
isPlainObject ( x: any ): x is PlainObject<any>; | ||
} | ||
} | ||
function isCash ( x: any ): x is Cash { | ||
return arr; | ||
return x instanceof Cash; | ||
} | ||
cash.each = each; | ||
function isWindow ( x: any ): x is Window { | ||
return !!x && x === x.window; | ||
// @require core/cash.ts | ||
// @require core/each.ts | ||
} | ||
interface Cash { | ||
each ( callback: EachCallback<EleLoose> ): this; | ||
function isDocument ( x: any ): x is Document { | ||
return !!x && x.nodeType === 9; | ||
} | ||
fn.each = function ( this: Cash, callback: EachCallback<EleLoose> ) { | ||
function isElement ( x: any ): x is HTMLElement { | ||
return each ( this, callback ); | ||
return !!x && x.nodeType === 1; | ||
}; | ||
} | ||
function isBoolean ( x: any ): x is boolean { | ||
// @require core/cash.ts | ||
// @require collection/each.ts | ||
// @require ./helpers/variables.ts | ||
return typeof x === 'boolean'; | ||
interface Cash { | ||
removeProp ( prop: string ): this; | ||
} | ||
fn.removeProp = function ( this: Cash, prop: string ) { | ||
function isFunction ( x: any ): x is Function { | ||
return this.each ( ( i, ele ) => { delete ele[propMap[prop] || prop] } ); | ||
return typeof x === 'function'; | ||
}; | ||
} | ||
function isString ( x: any ): x is string { | ||
// @require ./cash.ts | ||
return typeof x === 'string'; | ||
interface CashStatic { | ||
extend (): any; | ||
extend ( target: any ): typeof cash; | ||
extend ( target: any, ...objs: any[] ): any; | ||
} | ||
interface Cash { | ||
extend ( plugins: Record<any, any> ): this; | ||
function isUndefined ( x: any ): x is undefined { | ||
return x === undefined; | ||
} | ||
function extend ( target?: any, ...objs: any[] ) { | ||
function isNull ( x: any ): x is null { | ||
const length = arguments.length; | ||
return x === null; | ||
if ( !length ) return {}; | ||
} | ||
if ( length === 1 ) return extend ( cash, target ); | ||
function isNumeric ( x: any ): boolean { | ||
for ( let i = 1; i < length; i++ ) { | ||
return !isNaN ( parseFloat ( x ) ) && isFinite ( x ); | ||
for ( const key in arguments[i] ) { | ||
} | ||
target[key] = arguments[i][key]; | ||
function isPlainObject ( x: any ): x is PlainObject<any> { | ||
} | ||
if ( typeof x !== 'object' || x === null ) return false; | ||
} | ||
const proto = Object.getPrototypeOf ( x ); | ||
return target; | ||
return proto === null || proto === Object.prototype; | ||
} | ||
cash.extend = extend; | ||
cash.isWindow = isWindow; | ||
cash.isFunction = isFunction; | ||
cash.isArray = isArray; | ||
cash.isNumeric = isNumeric; | ||
cash.isPlainObject = isPlainObject; | ||
fn.extend = function ( plugins: Record<string, any> ) { | ||
return extend ( fn, plugins ); | ||
// @require core/cash.ts | ||
// @require core/type_checking.ts | ||
// @require core/variables.ts | ||
interface Cash { | ||
get (): EleLoose[]; | ||
get ( index: number ): EleLoose | undefined; | ||
} | ||
fn.get = function ( this: Cash, index?: number ) { | ||
if ( isUndefined ( index ) ) return slice.call ( this ); | ||
index = Number ( index ); | ||
return this[index < 0 ? index + this.length : index]; | ||
}; | ||
// @require ./cash.ts | ||
// @require core/cash.ts | ||
// @require ./get.ts | ||
interface CashStatic { | ||
guid: number; | ||
interface Cash { | ||
eq ( index: number ): Cash; | ||
} | ||
cash.guid = 1; | ||
fn.eq = function ( this: Cash, index: number ) { | ||
return cash ( this.get ( index ) ); | ||
// @require ./cash.ts | ||
}; | ||
function matches ( ele: any, selector: string ): boolean { | ||
const matches = ele && ( ele['matches'] || ele['webkitMatchesSelector'] || ele['msMatchesSelector'] ); | ||
// @require core/cash.ts | ||
// @require ./eq.ts | ||
return !!matches && !!selector && matches.call ( ele, selector ); | ||
interface Cash { | ||
first (): Cash; | ||
} | ||
fn.first = function ( this: Cash ) { | ||
// @require ./cash.ts | ||
// @require ./variables.ts | ||
return this.eq ( 0 ); | ||
interface CashStatic { | ||
isWindow ( x: any ): x is Window; | ||
isFunction ( x: any ): x is Function; | ||
isNumeric ( x: any ): boolean; | ||
isArray ( x: any ): x is Array<any>; | ||
} | ||
}; | ||
function isCash ( x: any ): x is Cash { | ||
return x instanceof Cash; | ||
// @require core/cash.ts | ||
// @require ./eq.ts | ||
interface Cash { | ||
last (): Cash; | ||
} | ||
function isWindow ( x: any ): x is Window { | ||
fn.last = function ( this: Cash ) { | ||
return !!x && x === x.window; | ||
return this.eq ( -1 ); | ||
} | ||
}; | ||
function isDocument ( x: any ): x is Document { | ||
return !!x && x.nodeType === 9; | ||
// @require ./cash.ts | ||
// @require ./type_checking.ts | ||
type EachArrayCallback<T> = ( this: T, index: number, ele: T ) => any; | ||
type EachObjectCallback<T> = ( this: T, key: string, value: T ) => any; | ||
interface CashStatic { | ||
each<T> ( arr: ArrayLike<T>, callback: EachArrayCallback<T> ): void; | ||
each<T> ( obj: PlainObject<T>, callback: EachObjectCallback<T> ): void; | ||
} | ||
function isElement ( x: any ): x is HTMLElement { | ||
function each<T, U extends ArrayLike<T> = ArrayLike<T>> ( arr: U, callback: EachArrayCallback<T>, _reverse?: boolean ): U; | ||
function each<T, U extends PlainObject<T> = PlainObject<T>> ( obj: U, callback: EachObjectCallback<T> ): U; | ||
function each<T, U extends ArrayLike<T> | PlainObject<T> = ArrayLike<T>> ( arr: U, callback: EachArrayCallback<T> | EachObjectCallback<T>, _reverse?: boolean ): U { | ||
return !!x && x.nodeType === 1; | ||
if ( _reverse ) { | ||
} | ||
let i = arr.length; | ||
function isFunction ( x: any ): x is Function { | ||
while ( i-- ) { | ||
return typeof x === 'function'; | ||
if ( callback.call ( arr[i], i, arr[i] ) === false ) return arr; | ||
} | ||
} | ||
function isString ( x: any ): x is string { | ||
} else if ( isPlainObject ( arr ) ) { | ||
return typeof x === 'string'; | ||
const keys = Object.keys ( arr ); | ||
} | ||
for ( let i = 0, l = keys.length; i < l; i++ ) { | ||
function isUndefined ( x: any ): x is undefined { | ||
const key = keys[i]; | ||
return x === undefined; | ||
if ( callback.call ( arr[key], key, arr[key] ) === false ) return arr; | ||
} | ||
} | ||
function isNull ( x: any ): x is null { | ||
} else { | ||
return x === null; | ||
for ( let i = 0, l = arr.length; i < l; i++ ) { | ||
if ( callback.call ( arr[i], i, arr[i] ) === false ) return arr; | ||
} | ||
} | ||
return arr; | ||
} | ||
function isNumeric ( x: any ): boolean { | ||
cash.each = each; | ||
return !isNaN ( parseFloat ( x ) ) && isFinite ( x ); | ||
// @require core/cash.ts | ||
// @require core/each.ts | ||
interface Cash { | ||
each ( callback: EachArrayCallback<EleLoose> ): this; | ||
} | ||
cash.isWindow = isWindow; | ||
cash.isFunction = isFunction; | ||
cash.isNumeric = isNumeric; | ||
cash.isArray = isArray; | ||
fn.each = function ( this: Cash, callback: EachArrayCallback<EleLoose> ) { | ||
return each ( this, callback ); | ||
}; | ||
// @require core/cash.ts | ||
@@ -446,60 +487,72 @@ // @require core/type_checking.ts | ||
// @require core/cash.ts | ||
// @require core/type_checking.ts | ||
// @require core/variables.ts | ||
// @require collection/each.ts | ||
// @require ./helpers/variables.ts | ||
interface Cash { | ||
get (): EleLoose[]; | ||
get ( index: number ): EleLoose | undefined; | ||
removeProp ( prop: string ): this; | ||
} | ||
fn.get = function ( this: Cash, index?: number ) { | ||
fn.removeProp = function ( this: Cash, prop: string ) { | ||
if ( isUndefined ( index ) ) return slice.call ( this ); | ||
return this.each ( ( i, ele ) => { delete ele[propMap[prop] || prop] } ); | ||
index = Number ( index ); | ||
}; | ||
return this[index < 0 ? index + this.length : index]; | ||
}; | ||
// @require ./cash.ts | ||
// @require ./type_checking.ts | ||
interface CashStatic { | ||
extend (): any; | ||
extend ( deep: true, target: any, ...sources: any[] ): any; | ||
extend ( target: any ): typeof cash; | ||
extend ( target: any, ...sources: any[] ): any; | ||
} | ||
// @require core/cash.ts | ||
// @require ./get.ts | ||
interface Cash { | ||
eq ( index: number ): Cash; | ||
extend ( plugins: Record<any, any> ): this; | ||
} | ||
fn.eq = function ( this: Cash, index: number ) { | ||
function extend ( ...sources: any[] ) { | ||
return cash ( this.get ( index ) ); | ||
const deep = isBoolean ( sources[0] ) ? sources.shift () : false, | ||
target = sources.shift (), | ||
length = sources.length; | ||
}; | ||
if ( !target ) return {}; | ||
if ( !length ) return extend ( deep, cash, target ); | ||
// @require core/cash.ts | ||
// @require ./eq.ts | ||
for ( let i = 0; i < length; i++ ) { | ||
interface Cash { | ||
first (): Cash; | ||
} | ||
const source = sources[i]; | ||
fn.first = function ( this: Cash ) { | ||
for ( const key in source ) { | ||
return this.eq ( 0 ); | ||
if ( deep && ( isArray ( source[key] ) || isPlainObject ( source[key] ) ) ) { | ||
}; | ||
if ( !target[key] || target[key].constructor !== source[key].constructor ) target[key] = new source[key].constructor (); | ||
extend ( deep, target[key], source[key] ); | ||
// @require core/cash.ts | ||
// @require ./eq.ts | ||
} else { | ||
interface Cash { | ||
last (): Cash; | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
} | ||
fn.last = function ( this: Cash ) { | ||
cash.extend = extend; | ||
return this.eq ( -1 ); | ||
fn.extend = function ( plugins: Record<string, any> ) { | ||
return extend ( fn, plugins ); | ||
}; | ||
@@ -506,0 +559,0 @@ |
{ | ||
"name": "cash-dom", | ||
"description": "An absurdly small jQuery alternative for modern browsers.", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "browser": "./dist/cash.js", |
@@ -14,5 +14,5 @@ | ||
| ------------------ | ----------- | ----------- | ----------------- | | ||
| 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 | | ||
| Unminified | **36.5 KB** | 58.7 KB | 227 KB | | ||
| Minified | **16 KB** | 26 KB | 71 KB | | ||
| Minified & Gzipped | **6 KB** | 9.8 KB | 24.4 KB | | ||
@@ -35,6 +35,6 @@ A **76.6%** gain in size reduction compared to jQuery. If you need a smaller bundle, we support [partial builds](https://github.com/fabiospampinato/cash/blob/master/docs/partial_builds.md) too. | ||
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/8.0.0/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@8.0.0/dist/cash.min.js) and use it like this: | ||
Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/8.1.0/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@8.1.0/dist/cash.min.js) and use it like this: | ||
```html | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/8.0.0/cash.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/cash/8.1.0/cash.min.js"></script> | ||
<script> | ||
@@ -864,9 +864,9 @@ $(function () { | ||
| Type Checking | Utilities | | ||
| ------------------------------- | ----------------------------- | | ||
| [$.isArray ()](#isarray-) | [$.guid](#guid) | | ||
| [$.isFunction ()](#isfunction-) | [$.each ()](#each-) | | ||
| [$.isNumeric ()](#isnumeric-) | [$.extend ()](#extend-) | | ||
| [$.isWindow ()](#iswindow-) | [$.parseHTML ()](#parsehtml-) | | ||
| | [$.unique ()](#unique-) | | ||
| Type Checking | Utilities | | ||
| ------------------------------------- | ----------------------------- | | ||
| [$.isArray ()](#isarray-) | [$.guid](#guid) | | ||
| [$.isFunction ()](#isfunction-) | [$.each ()](#each-) | | ||
| [$.isNumeric ()](#isnumeric-) | [$.extend ()](#extend-) | | ||
| [$.isPlainObject ()](#isplainobject-) | [$.parseHTML ()](#parsehtml-) | | ||
| [$.isWindow ()](#iswindow-) | [$.unique ()](#unique-) | | ||
@@ -883,6 +883,11 @@ #### $.guid | ||
Iterates through an array and calls the `callback ( index, element )` method on each element. The callback function may exit iteration early by returning `false`. | ||
Iterates through an array and calls the `callback ( index, element )` method on each element. | ||
Iterates through an object and calls the `callback ( key, value )` method on each property. | ||
The callback function may exit iteration early by returning `false`. | ||
```js | ||
$.each ( array, callback ) // => array | ||
$.each ( object, callback ) // => object | ||
``` | ||
@@ -892,6 +897,7 @@ | ||
Extends target object with properties from the source object. | ||
Extends target object with properties from the source object, potentially deeply too. | ||
```js | ||
$.extend ( target, source ) // => object | ||
$.extend ( true, target, source ) // => object | ||
``` | ||
@@ -924,2 +930,10 @@ | ||
#### $.isPlainObject () | ||
Check if the argument is a plain object. | ||
```js | ||
$.isPlainObject ( {} ) // => true | ||
``` | ||
#### $.isWindow () | ||
@@ -926,0 +940,0 @@ |
229557
4376
979