Socket
Socket
Sign inDemoInstall

cash-dom

Package Overview
Dependencies
0
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.5 to 1.3.6

.gitattributes

28

bower.json
{
"name": "cash",
"main": "dist/cash.js",
"version": "1.3.4",
"homepage": "https://github.com/kenwheeler/cash",
"authors": [
"Ken Wheeler <ken_wheeler@me.com>"
],
"description": "An absurdly small jQuery alternative for modern browsers.",
"keywords": [
"jquery",
"vanilla js"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"index.html"
]
"name": "cash",
"main": "dist/cash.js",
"version": "1.3.6",
"homepage": "https://github.com/kenwheeler/cash",
"authors": ["Ken Wheeler <ken_wheeler@me.com>"],
"description": "An absurdly small jQuery alternative for modern browsers.",
"keywords": ["jquery", "vanilla js"],
"license": "MIT",
"ignore": ["**/.*", "node_modules", "bower_components", "index.html"]
}
"use strict";
/*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */
/*! cash-dom 1.3.6, https://github.com/kenwheeler/cash @license MIT */
;(function (root, factory) {

@@ -33,3 +33,3 @@ if (typeof define === "function" && define.amd) {

if (!frag) {
frag = doc.implementation.createHTMLDocument();
frag = doc.implementation.createHTMLDocument(null);
var base = frag.createElement("base");

@@ -47,3 +47,3 @@ base.href = doc.location.href;

if (doc.readyState !== "loading") {
fn();
setTimeout(fn);
} else {

@@ -262,6 +262,6 @@ doc.addEventListener("DOMContentLoaded", fn);

function addClass(v, c, spacedName) {
function addClass(v, c) {
if (v.classList) {
v.classList.add(c);
} else if (spacedName.indexOf(" " + c + " ")) {
} else if (!hasClass(v, c)) {
v.className += " " + c;

@@ -284,5 +284,4 @@ }

return (classes ? this.each(function (v) {
var spacedName = " " + v.className + " ";
each(classes, function (c) {
addClass(v, c, spacedName);
addClass(v, c);
});

@@ -377,3 +376,2 @@ }) : this);

return (classes ? this.each(function (v) {
var spacedName = " " + v.className + " ";
each(classes, function (c) {

@@ -383,3 +381,3 @@ if (hasClass(v, c)) {

} else {
addClass(v, c, spacedName);
addClass(v, c);
}

@@ -386,0 +384,0 @@ });

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

"use strict";!function(t,e){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof exports?module.exports=e():t.cash=t.$=e()}(this,function(){function t(t,e){e=e||T;var n=q.test(t)?e.getElementsByClassName(t.slice(1)):$.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t);return n}function e(t){if(!A){A=T.implementation.createHTMLDocument();var e=A.createElement("base");e.href=T.location.href,A.head.appendChild(e)}return A.body.innerHTML=t,A.body.childNodes}function n(t){"loading"!==T.readyState?t():T.addEventListener("DOMContentLoaded",t)}function r(r,i){if(!r)return this;if(r.cash&&r!==S)return r;var u,o=r,s=0;if(P(r))o=R.test(r)?T.getElementById(r.slice(1)):D.test(r)?e(r):t(r,i);else if(I(r))return n(r),this;if(!o)return this;if(o.nodeType||o===S)this[0]=o,this.length=1;else for(u=this.length=o.length;u>s;s++)this[s]=o[s];return this}function i(t,e){return new r(t,e)}function u(t,e){for(var n=t.length,r=0;n>r&&e.call(t[r],t[r],r,t)!==!1;r++);}function o(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector);return!!n&&n.call(t,e)}function s(t){return P(t)?o:t.cash?function(e){return t.is(e)}:function(t,e){return t===e}}function c(t){return i(B.call(t).filter(function(t,e,n){return n.indexOf(t)===e}))}function a(t){return t[F]=t[F]||{}}function f(t,e,n){return a(t)[e]=n}function h(t,e){var n=a(t);return void 0===n[e]&&(n[e]=t.dataset?t.dataset[e]:i(t).attr("data-"+e)),n[e]}function l(t,e){var n=a(t);n?delete n[e]:t.dataset?delete t.dataset[e]:i(t).removeAttr("data-"+name)}function d(t){return P(t)&&t.match(U)}function v(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function p(t,e,n){t.classList?t.classList.add(e):n.indexOf(" "+e+" ")&&(t.className+=" "+e)}function m(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"")}function g(t,e){return parseInt(S.getComputedStyle(t[0],null)[e],10)||0}function y(t,e,n){var r=h(t,"_cashEvents")||f(t,"_cashEvents",{});r[e]=r[e]||[],r[e].push(n),t.addEventListener(e,n)}function x(t,e,n){var r,i=h(t,"_cashEvents"),o=i&&i[e];o&&(n?(t.removeEventListener(e,n),r=o.indexOf(n),r>=0&&o.splice(r,1)):(u(o,function(n){t.removeEventListener(e,n)}),o=[]))}function b(t,e){return"&"+encodeURIComponent(t)+"="+encodeURIComponent(e).replace(/%20/g,"+")}function L(t){var e=[];return u(t.options,function(t){t.selected&&e.push(t.value)}),e.length?e:null}function N(t){var e=t.selectedIndex;return e>=0?t.options[e].value:null}function C(t){var e=t.type;if(!e)return null;switch(e.toLowerCase()){case"select-one":return N(t);case"select-multiple":return L(t);case"radio":return t.checked?t.value:null;case"checkbox":return t.checked?t.value:null;default:return t.value?t.value:null}}function E(t,e,n){if(n){var r=t.childNodes[0];t.insertBefore(e,r)}else t.appendChild(e)}function w(t,e,n){var r=P(e);return!r&&e.length?void u(e,function(e){return w(t,e,n)}):void u(t,r?function(t){return t.insertAdjacentHTML(n?"afterbegin":"beforeend",e)}:function(t,r){return E(t,0===r?e:e.cloneNode(!0),n)})}var A,T=document,S=window,M=Array.prototype,B=M.slice,H=M.filter,O=M.push,k=function(){},I=function(t){return typeof t==typeof k&&t.call},P=function(t){return"string"==typeof t},R=/^#[\w-]*$/,q=/^\.[\w-]*$/,D=/<.+>/,$=/^\w+$/,_=i.fn=i.prototype=r.prototype={cash:!0,length:0,push:O,splice:M.splice,map:M.map,init:r};Object.defineProperty(_,"constructor",{value:i}),i.parseHTML=e,i.noop=k,i.isFunction=I,i.isString=P,i.extend=_.extend=function(t){t=t||{};var e=B.call(arguments),n=e.length,r=1;for(1===e.length&&(t=this,r=0);n>r;r++)if(e[r])for(var i in e[r])e[r].hasOwnProperty(i)&&(t[i]=e[r][i]);return t},i.extend({merge:function(t,e){for(var n=+e.length,r=t.length,i=0;n>i;r++,i++)t[r]=e[i];return t.length=r,t},each:u,matches:o,unique:c,isArray:Array.isArray,isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}});var F=i.uid="_cash"+Date.now();_.extend({data:function(t,e){if(P(t))return void 0===e?h(this[0],t):this.each(function(n){return f(n,t,e)});for(var n in t)this.data(n,t[n]);return this},removeData:function(t){return this.each(function(e){return l(e,t)})}});var U=/\S+/g;_.extend({addClass:function(t){var e=d(t);return e?this.each(function(t){var n=" "+t.className+" ";u(e,function(e){p(t,e,n)})}):this},attr:function(t,e){if(t){if(P(t))return void 0===e?this[0]?this[0].getAttribute?this[0].getAttribute(t):this[0][t]:void 0:this.each(function(n){n.setAttribute?n.setAttribute(t,e):n[t]=e});for(var n in t)this.attr(n,t[n]);return this}},hasClass:function(t){var e=!1,n=d(t);return n&&n.length&&this.each(function(t){return e=v(t,n[0]),!e}),e},prop:function(t,e){if(P(t))return void 0===e?this[0][t]:this.each(function(n){n[t]=e});for(var n in t)this.prop(n,t[n]);return this},removeAttr:function(t){return this.each(function(e){e.removeAttribute?e.removeAttribute(t):delete e[t]})},removeClass:function(t){if(!arguments.length)return this.attr("class","");var e=d(t);return e?this.each(function(t){u(e,function(e){m(t,e)})}):this},removeProp:function(t){return this.each(function(e){delete e[t]})},toggleClass:function(t,e){if(void 0!==e)return this[e?"addClass":"removeClass"](t);var n=d(t);return n?this.each(function(t){var e=" "+t.className+" ";u(n,function(n){v(t,n)?m(t,n):p(t,n,e)})}):this}}),_.extend({add:function(t,e){return c(i.merge(this,i(t,e)))},each:function(t){return u(this,t),this},eq:function(t){return i(this.get(t))},filter:function(t){if(!t)return this;var e=I(t)?t:s(t);return i(H.call(this,function(n){return e(n,t)}))},first:function(){return this.eq(0)},get:function(t){return void 0===t?B.call(this):0>t?this[t+this.length]:this[t]},index:function(t){var e=t?i(t)[0]:this[0],n=t?this:i(e).parent().children();return B.call(n).indexOf(e)},last:function(){return this.eq(-1)}});var j=function(){var t=/(?:^\w|[A-Z]|\b\w)/g,e=/[\s-_]+/g;return function(n){return n.replace(t,function(t,e){return t[0===e?"toLowerCase":"toUpperCase"]()}).replace(e,"")}}(),z=function(){var t={},e=document,n=e.createElement("div"),r=n.style;return function(e){if(e=j(e),t[e])return t[e];var n=e.charAt(0).toUpperCase()+e.slice(1),i=["webkit","moz","ms","o"],o=(e+" "+i.join(n+" ")+n).split(" ");return u(o,function(n){return n in r?(t[n]=e=t[e]=n,!1):void 0}),t[e]}}();i.prefixedProp=z,i.camelCase=j,_.extend({css:function(t,e){if(P(t))return t=z(t),arguments.length>1?this.each(function(n){return n.style[t]=e}):S.getComputedStyle(this[0])[t];for(var n in t)this.css(n,t[n]);return this}}),u(["Width","Height"],function(t){var e=t.toLowerCase();_[e]=function(){return this[0].getBoundingClientRect()[e]},_["inner"+t]=function(){return this[0]["client"+t]},_["outer"+t]=function(e){return this[0]["offset"+t]+(e?g(this,"margin"+("Width"===t?"Left":"Top"))+g(this,"margin"+("Width"===t?"Right":"Bottom")):0)}}),_.extend({off:function(t,e){return this.each(function(n){return x(n,t,e)})},on:function(t,e,r,i){var u;if(!P(t)){for(var s in t)this.on(s,e,t[s]);return this}return I(e)&&(r=e,e=null),"ready"===t?(n(r),this):(e&&(u=r,r=function(t){for(var n=t.target;!o(n,e);){if(n===this)return n=!1;n=n.parentNode}n&&u.call(n,t)}),this.each(function(e){var n=r;i&&(n=function(){r.apply(this,arguments),x(e,t,n)}),y(e,t,n)}))},one:function(t,e,n){return this.on(t,e,n,!0)},ready:n,trigger:function(t,e){var n=T.createEvent("HTMLEvents");return n.data=e,n.initEvent(t,!0,!1),this.each(function(t){return t.dispatchEvent(n)})}}),_.extend({serialize:function(){var t="";return u(this[0].elements||this,function(e){if(!e.disabled&&"FIELDSET"!==e.tagName){var n=e.name;switch(e.type.toLowerCase()){case"file":case"reset":case"submit":case"button":break;case"select-multiple":var r=C(e);null!==r&&u(r,function(e){t+=b(n,e)});break;default:var i=C(e);null!==i&&(t+=b(n,i))}}}),t.substr(1)},val:function(t){return void 0===t?C(this[0]):this.each(function(e){return e.value=t})}}),_.extend({after:function(t){return i(t).insertAfter(this),this},append:function(t){return w(this,t),this},appendTo:function(t){return w(i(t),this),this},before:function(t){return i(t).insertBefore(this),this},clone:function(){return i(this.map(function(t){return t.cloneNode(!0)}))},empty:function(){return this.html(""),this},html:function(t){if(void 0===t)return this[0].innerHTML;var e=t.nodeType?t[0].outerHTML:t;return this.each(function(t){return t.innerHTML=e})},insertAfter:function(t){var e=this;return i(t).each(function(t,n){var r=t.parentNode,i=t.nextSibling;e.each(function(t){r.insertBefore(0===n?t:t.cloneNode(!0),i)})}),this},insertBefore:function(t){var e=this;return i(t).each(function(t,n){var r=t.parentNode;e.each(function(e){r.insertBefore(0===n?e:e.cloneNode(!0),t)})}),this},prepend:function(t){return w(this,t,!0),this},prependTo:function(t){return w(i(t),this,!0),this},remove:function(){return this.each(function(t){return t.parentNode.removeChild(t)})},text:function(t){return void 0===t?this[0].textContent:this.each(function(e){return e.textContent=t})}});var W=T.documentElement;return _.extend({position:function(){var t=this[0];return{left:t.offsetLeft,top:t.offsetTop}},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+S.pageYOffset-W.clientTop,left:t.left+S.pageXOffset-W.clientLeft}},offsetParent:function(){return i(this[0].offsetParent)}}),_.extend({children:function(t){var e=[];return this.each(function(t){O.apply(e,t.children)}),e=c(e),t?e.filter(function(e){return o(e,t)}):e},closest:function(t){return!t||this.length<1?i():this.is(t)?this.filter(t):this.parent().closest(t)},is:function(t){if(!t)return!1;var e=!1,n=s(t);return this.each(function(r){return e=n(r,t),!e}),e},find:function(e){if(!e||e.nodeType)return i(e&&this.has(e).length?e:null);var n=[];return this.each(function(r){O.apply(n,t(e,r))}),c(n)},has:function(e){var n=P(e)?function(n){return 0!==t(e,n).length}:function(t){return t.contains(e)};return this.filter(n)},next:function(){return i(this[0].nextElementSibling)},not:function(t){if(!t)return this;var e=s(t);return this.filter(function(n){return!e(n,t)})},parent:function(){var t=[];return this.each(function(e){e&&e.parentNode&&t.push(e.parentNode)}),c(t)},parents:function(t){var e,n=[];return this.each(function(r){for(e=r;e&&e.parentNode&&e!==T.body.parentNode;)e=e.parentNode,(!t||t&&o(e,t))&&n.push(e)}),c(n)},prev:function(){return i(this[0].previousElementSibling)},siblings:function(){var t=this.parent().children(),e=this[0];return t.filter(function(t){return t!==e})}}),i});
"use strict";/*! cash-dom 1.3.6, https://github.com/kenwheeler/cash @license MIT */!function(t,e){"function"==typeof define&&define.amd?define(e):"undefined"!=typeof exports?module.exports=e():t.cash=t.$=e()}(this,function(){function t(t,e){e=e||A;var n=q.test(t)?e.getElementsByClassName(t.slice(1)):$.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t);return n}function e(t){if(!T){T=A.implementation.createHTMLDocument(null);var e=T.createElement("base");e.href=A.location.href,T.head.appendChild(e)}return T.body.innerHTML=t,T.body.childNodes}function n(t){"loading"!==A.readyState?setTimeout(t):A.addEventListener("DOMContentLoaded",t)}function r(r,i){if(!r)return this;if(r.cash&&r!==S)return r;var u,o=r,s=0;if(P(r))o=R.test(r)?A.getElementById(r.slice(1)):D.test(r)?e(r):t(r,i);else if(I(r))return n(r),this;if(!o)return this;if(o.nodeType||o===S)this[0]=o,this.length=1;else for(u=this.length=o.length;s<u;s++)this[s]=o[s];return this}function i(t,e){return new r(t,e)}function u(t,e){for(var n=t.length,r=0;r<n&&e.call(t[r],t[r],r,t)!==!1;r++);}function o(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector);return!!n&&n.call(t,e)}function s(t){return P(t)?o:t.cash?function(e){return t.is(e)}:function(t,e){return t===e}}function c(t){return i(B.call(t).filter(function(t,e,n){return n.indexOf(t)===e}))}function a(t){return t[F]=t[F]||{}}function f(t,e,n){return a(t)[e]=n}function h(t,e){var n=a(t);return void 0===n[e]&&(n[e]=t.dataset?t.dataset[e]:i(t).attr("data-"+e)),n[e]}function l(t,e){var n=a(t);n?delete n[e]:t.dataset?delete t.dataset[e]:i(t).removeAttr("data-"+name)}function d(t){return P(t)&&t.match(U)}function v(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}function p(t,e){t.classList?t.classList.add(e):v(t,e)||(t.className+=" "+e)}function m(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"")}function g(t,e){return parseInt(S.getComputedStyle(t[0],null)[e],10)||0}function y(t,e,n){var r=h(t,"_cashEvents")||f(t,"_cashEvents",{});r[e]=r[e]||[],r[e].push(n),t.addEventListener(e,n)}function b(t,e,n){var r,i=h(t,"_cashEvents"),o=i&&i[e];o&&(n?(t.removeEventListener(e,n),r=o.indexOf(n),r>=0&&o.splice(r,1)):(u(o,function(n){t.removeEventListener(e,n)}),o=[]))}function x(t,e){return"&"+encodeURIComponent(t)+"="+encodeURIComponent(e).replace(/%20/g,"+")}function L(t){var e=[];return u(t.options,function(t){t.selected&&e.push(t.value)}),e.length?e:null}function C(t){var e=t.selectedIndex;return e>=0?t.options[e].value:null}function N(t){var e=t.type;if(!e)return null;switch(e.toLowerCase()){case"select-one":return C(t);case"select-multiple":return L(t);case"radio":return t.checked?t.value:null;case"checkbox":return t.checked?t.value:null;default:return t.value?t.value:null}}function E(t,e,n){if(n){var r=t.childNodes[0];t.insertBefore(e,r)}else t.appendChild(e)}function w(t,e,n){var r=P(e);return!r&&e.length?void u(e,function(e){return w(t,e,n)}):void u(t,r?function(t){return t.insertAdjacentHTML(n?"afterbegin":"beforeend",e)}:function(t,r){return E(t,0===r?e:e.cloneNode(!0),n)})}var T,A=document,S=window,M=Array.prototype,B=M.slice,H=M.filter,O=M.push,k=function(){},I=function(t){return typeof t==typeof k&&t.call},P=function(t){return"string"==typeof t},R=/^#[\w-]*$/,q=/^\.[\w-]*$/,D=/<.+>/,$=/^\w+$/,_=i.fn=i.prototype=r.prototype={cash:!0,length:0,push:O,splice:M.splice,map:M.map,init:r};Object.defineProperty(_,"constructor",{value:i}),i.parseHTML=e,i.noop=k,i.isFunction=I,i.isString=P,i.extend=_.extend=function(t){t=t||{};var e=B.call(arguments),n=e.length,r=1;for(1===e.length&&(t=this,r=0);r<n;r++)if(e[r])for(var i in e[r])e[r].hasOwnProperty(i)&&(t[i]=e[r][i]);return t},i.extend({merge:function(t,e){for(var n=+e.length,r=t.length,i=0;i<n;r++,i++)t[r]=e[i];return t.length=r,t},each:u,matches:o,unique:c,isArray:Array.isArray,isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}});var F=i.uid="_cash"+Date.now();_.extend({data:function(t,e){if(P(t))return void 0===e?h(this[0],t):this.each(function(n){return f(n,t,e)});for(var n in t)this.data(n,t[n]);return this},removeData:function(t){return this.each(function(e){return l(e,t)})}});var U=/\S+/g;_.extend({addClass:function(t){var e=d(t);return e?this.each(function(t){u(e,function(e){p(t,e)})}):this},attr:function(t,e){if(t){if(P(t))return void 0===e?this[0]?this[0].getAttribute?this[0].getAttribute(t):this[0][t]:void 0:this.each(function(n){n.setAttribute?n.setAttribute(t,e):n[t]=e});for(var n in t)this.attr(n,t[n]);return this}},hasClass:function(t){var e=!1,n=d(t);return n&&n.length&&this.each(function(t){return e=v(t,n[0]),!e}),e},prop:function(t,e){if(P(t))return void 0===e?this[0][t]:this.each(function(n){n[t]=e});for(var n in t)this.prop(n,t[n]);return this},removeAttr:function(t){return this.each(function(e){e.removeAttribute?e.removeAttribute(t):delete e[t]})},removeClass:function(t){if(!arguments.length)return this.attr("class","");var e=d(t);return e?this.each(function(t){u(e,function(e){m(t,e)})}):this},removeProp:function(t){return this.each(function(e){delete e[t]})},toggleClass:function(t,e){if(void 0!==e)return this[e?"addClass":"removeClass"](t);var n=d(t);return n?this.each(function(t){u(n,function(e){v(t,e)?m(t,e):p(t,e)})}):this}}),_.extend({add:function(t,e){return c(i.merge(this,i(t,e)))},each:function(t){return u(this,t),this},eq:function(t){return i(this.get(t))},filter:function(t){if(!t)return this;var e=I(t)?t:s(t);return i(H.call(this,function(n){return e(n,t)}))},first:function(){return this.eq(0)},get:function(t){return void 0===t?B.call(this):t<0?this[t+this.length]:this[t]},index:function(t){var e=t?i(t)[0]:this[0],n=t?this:i(e).parent().children();return B.call(n).indexOf(e)},last:function(){return this.eq(-1)}});var j=function(){var t=/(?:^\w|[A-Z]|\b\w)/g,e=/[\s-_]+/g;return function(n){return n.replace(t,function(t,e){return t[0===e?"toLowerCase":"toUpperCase"]()}).replace(e,"")}}(),z=function(){var t={},e=document,n=e.createElement("div"),r=n.style;return function(e){if(e=j(e),t[e])return t[e];var n=e.charAt(0).toUpperCase()+e.slice(1),i=["webkit","moz","ms","o"],o=(e+" "+i.join(n+" ")+n).split(" ");return u(o,function(n){if(n in r)return t[n]=e=t[e]=n,!1}),t[e]}}();i.prefixedProp=z,i.camelCase=j,_.extend({css:function(t,e){if(P(t))return t=z(t),arguments.length>1?this.each(function(n){return n.style[t]=e}):S.getComputedStyle(this[0])[t];for(var n in t)this.css(n,t[n]);return this}}),u(["Width","Height"],function(t){var e=t.toLowerCase();_[e]=function(){return this[0].getBoundingClientRect()[e]},_["inner"+t]=function(){return this[0]["client"+t]},_["outer"+t]=function(e){return this[0]["offset"+t]+(e?g(this,"margin"+("Width"===t?"Left":"Top"))+g(this,"margin"+("Width"===t?"Right":"Bottom")):0)}}),_.extend({off:function(t,e){return this.each(function(n){return b(n,t,e)})},on:function(t,e,r,i){var u;if(!P(t)){for(var s in t)this.on(s,e,t[s]);return this}return I(e)&&(r=e,e=null),"ready"===t?(n(r),this):(e&&(u=r,r=function(t){for(var n=t.target;!o(n,e);){if(n===this)return n=!1;n=n.parentNode}n&&u.call(n,t)}),this.each(function(e){var n=r;i&&(n=function(){r.apply(this,arguments),b(e,t,n)}),y(e,t,n)}))},one:function(t,e,n){return this.on(t,e,n,!0)},ready:n,trigger:function(t,e){var n=A.createEvent("HTMLEvents");return n.data=e,n.initEvent(t,!0,!1),this.each(function(t){return t.dispatchEvent(n)})}}),_.extend({serialize:function(){var t="";return u(this[0].elements||this,function(e){if(!e.disabled&&"FIELDSET"!==e.tagName){var n=e.name;switch(e.type.toLowerCase()){case"file":case"reset":case"submit":case"button":break;case"select-multiple":var r=N(e);null!==r&&u(r,function(e){t+=x(n,e)});break;default:var i=N(e);null!==i&&(t+=x(n,i))}}}),t.substr(1)},val:function(t){return void 0===t?N(this[0]):this.each(function(e){return e.value=t})}}),_.extend({after:function(t){return i(t).insertAfter(this),this},append:function(t){return w(this,t),this},appendTo:function(t){return w(i(t),this),this},before:function(t){return i(t).insertBefore(this),this},clone:function(){return i(this.map(function(t){return t.cloneNode(!0)}))},empty:function(){return this.html(""),this},html:function(t){if(void 0===t)return this[0].innerHTML;var e=t.nodeType?t[0].outerHTML:t;return this.each(function(t){return t.innerHTML=e})},insertAfter:function(t){var e=this;return i(t).each(function(t,n){var r=t.parentNode,i=t.nextSibling;e.each(function(t){r.insertBefore(0===n?t:t.cloneNode(!0),i)})}),this},insertBefore:function(t){var e=this;return i(t).each(function(t,n){var r=t.parentNode;e.each(function(e){r.insertBefore(0===n?e:e.cloneNode(!0),t)})}),this},prepend:function(t){return w(this,t,!0),this},prependTo:function(t){return w(i(t),this,!0),this},remove:function(){return this.each(function(t){return t.parentNode.removeChild(t)})},text:function(t){return void 0===t?this[0].textContent:this.each(function(e){return e.textContent=t})}});var W=A.documentElement;return _.extend({position:function(){var t=this[0];return{left:t.offsetLeft,top:t.offsetTop}},offset:function(){var t=this[0].getBoundingClientRect();return{top:t.top+S.pageYOffset-W.clientTop,left:t.left+S.pageXOffset-W.clientLeft}},offsetParent:function(){return i(this[0].offsetParent)}}),_.extend({children:function(t){var e=[];return this.each(function(t){O.apply(e,t.children)}),e=c(e),t?e.filter(function(e){return o(e,t)}):e},closest:function(t){return!t||this.length<1?i():this.is(t)?this.filter(t):this.parent().closest(t)},is:function(t){if(!t)return!1;var e=!1,n=s(t);return this.each(function(r){return e=n(r,t),!e}),e},find:function(e){if(!e||e.nodeType)return i(e&&this.has(e).length?e:null);var n=[];return this.each(function(r){O.apply(n,t(e,r))}),c(n)},has:function(e){var n=P(e)?function(n){return 0!==t(e,n).length}:function(t){return t.contains(e)};return this.filter(n)},next:function(){return i(this[0].nextElementSibling)},not:function(t){if(!t)return this;var e=s(t);return this.filter(function(n){return!e(n,t)})},parent:function(){var t=[];return this.each(function(e){e&&e.parentNode&&t.push(e.parentNode)}),c(t)},parents:function(t){var e,n=[];return this.each(function(r){for(e=r;e&&e.parentNode&&e!==A.body.parentNode;)e=e.parentNode,(!t||t&&o(e,t))&&n.push(e)}),c(n)},prev:function(){return i(this[0].previousElementSibling)},siblings:function(){var t=this.parent().children(),e=this[0];return t.filter(function(t){return t!==e})}}),i});

@@ -1,47 +0,63 @@

'use strict';
"use strict";
var gulp = require('gulp');
var pkg = require('./package.json');
var $ = require('gulp-load-plugins')();
var gulp = require("gulp");
var pkg = require("./package.json");
var $ = require("gulp-load-plugins")();
gulp.task('build', function () {
return gulp.src('./src/_wrapper.js')
.pipe($.preprocess({
context: {
header: '/*! ' + pkg.name + ' '+pkg.version +', '+pkg.homepage +' @license '+ pkg.license +' */'
}
}))
.pipe($.rename('cash.js'))
.pipe($['6to5']())
gulp.task("build", function() {
return gulp
.src("./src/_wrapper.js")
.pipe(
$.preprocess({
context: {
header:
"/*! " +
pkg.name +
" " +
pkg.version +
", " +
pkg.homepage +
" @license " +
pkg.license +
" */"
}
})
)
.pipe($.rename("cash.js"))
.pipe($["6to5"]())
.pipe($.size())
.pipe($.size({ gzip: true }))
.pipe(gulp.dest('./dist/'));
.pipe(gulp.dest("./dist/"));
});
gulp.task('minify', ['build'], function() {
return gulp.src(['./dist/cash.js'])
.pipe($.uglify({
preserveComments: 'license'
}))
gulp.task("minify", ["build"], function() {
return gulp
.src(["./dist/cash.js"])
.pipe(
$.uglify({
preserveComments: "license",
comments: "license"
})
)
.pipe($.size())
.pipe($.size({ gzip: true }))
.pipe($.rename('cash.min.js'))
.pipe(gulp.dest('./dist/'));
.pipe($.rename("cash.min.js"))
.pipe(gulp.dest("./dist/"));
});
gulp.task('lint', function() {
return gulp.src(['src/*.js', '!src/_*.js'])
gulp.task("lint", function() {
return gulp
.src(["src/*.js", "!src/_*.js"])
.pipe($.jshint())
.pipe($.jshint.reporter('default'));
.pipe($.jshint.reporter("default"));
});
gulp.task('test', function() {
return gulp.src('./test/index.html')
.pipe($.qunit());
gulp.task("test", function() {
return gulp.src("./test/index.html").pipe($.qunit());
});
gulp.task('default', ['build', 'minify', 'lint']);
gulp.task("default", ["build", "minify", "lint"]);
gulp.task('watch', function() {
gulp.watch(['src/*.js', 'test/src/*.js'], ['default']);
gulp.task("watch", function() {
gulp.watch(["src/*.js", "test/src/*.js"], ["default"]);
});
{
"name": "cash-dom",
"version": "1.3.5",
"version": "1.3.6",
"description": "An absurdly small jQuery alternative for modern browsers.",

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

@@ -1,2 +0,2 @@

#Cash
# Cash
*An absurdly small jQuery alternative for modern browsers (IE9+)*

@@ -24,6 +24,6 @@

Add cash to your project on your server or using the [jsDelivr](https://cdn.jsdelivr.net/cash/1.3.0/cash.min.js) or [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/1.3.0/cash.min.js) CDNs, and use cash to manipulate the DOM!
Add cash to your project on your server or using the [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@1.3.5/dist/cash.min.js) or [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/1.3.0/cash.min.js) CDNs, and use cash to manipulate the DOM!
```html
<script src="https://cdn.jsdelivr.net/cash/1.3.0/cash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/cash-dom@1.3.5/dist/cash.min.js"></script>
<script>

@@ -30,0 +30,0 @@ $(function(){

@@ -14,5 +14,5 @@ var notWhiteMatch = /\S+/g;

function addClass(v,c,spacedName){
function addClass(v,c){
if (v.classList) { v.classList.add(c); }
else if ( spacedName.indexOf(` ${c} `) ) { v.className += ' ' + c; }
else if ( !hasClass(v, c)) { v.className += ' ' + c; }
}

@@ -32,4 +32,3 @@

this.each(v => {
var spacedName = ` ${v.className} `;
each(classes,c => { addClass(v,c,spacedName); });
each(classes,c => { addClass(v,c); });
}) :

@@ -122,5 +121,4 @@ this

this.each(v => {
var spacedName = ` ${v.className} `;
each(classes,c => {
if ( hasClass(v,c) ) { removeClass(v,c); } else { addClass(v,c,spacedName); }
if ( hasClass(v,c) ) { removeClass(v,c); } else { addClass(v,c); }
});

@@ -127,0 +125,0 @@ }) :

@@ -28,3 +28,3 @@ var noop = function(){},

if (!frag) {
frag = doc.implementation.createHTMLDocument();
frag = doc.implementation.createHTMLDocument(null);
var base = frag.createElement('base');

@@ -41,3 +41,3 @@ base.href = doc.location.href;

function onReady(fn) {
if ( doc.readyState !== 'loading' ) { fn(); }
if ( doc.readyState !== 'loading' ) { setTimeout(fn); }
else { doc.addEventListener('DOMContentLoaded', fn); }

@@ -44,0 +44,0 @@ }

@@ -508,1 +508,17 @@ // Core

});
// DOM ready
QUnit.test( "$(fn)", function( assert ) {
var called = false;
var readyFn = function() { called = true; }
$(readyFn);
assert.equal(called, false);
stop();
setTimeout(function() {
assert.equal(called, true);
start();
}, 10);
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc