diff --git a/changelog.md b/changelog.md index a121b9d..b8849af 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,12 @@ +### [v8.1.4](https://github.com/fabiospampinato/cash/releases/tag/8.1.4) (2023-03-08) + +- Updatd contribution guide +- Replaced Karma with Playwright, removing most dev dependencies, removing coverage reports, and adding support for Safari +- Updated dependencies +- Lowercased readme file +- Lowercased changelog file +- $.serialize: avoiding encoding "%20" as "+", for better alignment with jQuery + ### [v8.1.3](https://github.com/fabiospampinato/cash/releases/tag/8.1.3) (2023-01-31) - $.fn.text: ensuring it reads text from every node in the collection, not just the first one, for better alignment with jQuery diff --git a/dist/cash.esm.js b/dist/cash.esm.js index d032444..b719dba 100644 --- a/dist/cash.esm.js +++ b/dist/cash.esm.js @@ -1101,10 +1101,9 @@ function one(eventFullName, selector, data, callback) { } ; fn.one = one; -const queryEncodeSpaceRe = /%20/g; const queryEncodeCRLFRe = /\r?\n/g; function queryEncode(prop, value) { - return `&${encodeURIComponent(prop)}=${encodeURIComponent(value.replace(queryEncodeCRLFRe, '\r\n')).replace(queryEncodeSpaceRe, '+')}`; + return `&${encodeURIComponent(prop)}=${encodeURIComponent(value.replace(queryEncodeCRLFRe, '\r\n'))}`; } const skippableRe = /file|reset|submit|button|image/i; const checkableRe = /radio|checkbox/i; diff --git a/dist/cash.js b/dist/cash.js index 15dd7ef..d3dc2bc 100644 --- a/dist/cash.js +++ b/dist/cash.js @@ -1113,10 +1113,9 @@ function one(eventFullName, selector, data, callback) { } ; fn.one = one; -var queryEncodeSpaceRe = /%20/g; var queryEncodeCRLFRe = /\r?\n/g; function queryEncode(prop, value) { - return "&".concat(encodeURIComponent(prop), "=").concat(encodeURIComponent(value.replace(queryEncodeCRLFRe, '\r\n')).replace(queryEncodeSpaceRe, '+')); + return "&".concat(encodeURIComponent(prop), "=").concat(encodeURIComponent(value.replace(queryEncodeCRLFRe, '\r\n'))); } var skippableRe = /file|reset|submit|button|image/i; var checkableRe = /radio|checkbox/i; diff --git a/dist/cash.min.js b/dist/cash.min.js index 304b6b5..be1f496 100644 --- a/dist/cash.min.js +++ b/dist/cash.min.js @@ -1,2 +1,2 @@ -(function(){"use strict";var C=document,M=window,st=C.documentElement,L=C.createElement.bind(C),ft=L("div"),q=L("table"),Mt=L("tbody"),ot=L("tr"),H=Array.isArray,S=Array.prototype,Bt=S.concat,U=S.filter,at=S.indexOf,ct=S.map,Dt=S.push,ht=S.slice,z=S.some,_t=S.splice,Pt=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,Ht=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,It=/<.+>/,$t=/^\w+$/;function J(t,n){var r=jt(n);return!t||!r&&!D(n)&&!c(n)?[]:!r&&Ht.test(t)?n.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!r&&$t.test(t)?n.getElementsByTagName(t):n.querySelectorAll(t)}var dt=function(){function t(n,r){if(!!n){if(Y(n))return n;var i=n;if(g(n)){var u=(Y(r)?r[0]:r)||C;if(i=Pt.test(n)&&"getElementById"in u?u.getElementById(n.slice(1).replace(/\\/g,"")):It.test(n)?yt(n):J(n,u),!i)return}else if(A(n))return this.ready(n);(i.nodeType||i===M)&&(i=[i]),this.length=i.length;for(var s=0,f=this.length;s]*>/,Gt=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,mt={"*":ft,tr:Mt,td:ot,th:ot,thead:q,tbody:q,tfoot:q};function yt(t){if(!g(t))return[];if(Gt.test(t))return[L(RegExp.$1)];var n=Yt.test(t)&&RegExp.$1,r=mt[n]||mt["*"];return r.innerHTML=t,o(r.childNodes).detach().get()}o.parseHTML=yt,e.has=function(t){var n=g(t)?function(r,i){return J(t,i).length}:function(r,i){return i.contains(t)};return this.filter(n)},e.not=function(t){var n=j(t);return this.filter(function(r,i){return(!g(t)||c(i))&&!n.call(i,r,i)})};function R(t,n,r,i){for(var u=[],s=A(n),f=i&&j(i),a=0,y=t.length;a=0},!0):r.checked=u.indexOf(r.value)>=0}else r.value=v(t)||P(t)?"":t}):this[0]&&bt(this[0])}e.val=Xt,e.is=function(t){var n=j(t);return z.call(this,function(r,i){return n.call(r,i,r)})},o.guid=1;function w(t){return t.length>1?U.call(t,function(n,r,i){return at.call(i,n)===r}):t}o.unique=w,e.add=function(t,n){return o(w(this.get().concat(o(t,n).get())))},e.children=function(t){return x(o(w(R(this,function(n){return n.children}))),t)},e.parent=function(t){return x(o(w(R(this,"parentNode"))),t)},e.index=function(t){var n=t?o(t)[0]:this[0],r=t?this:o(n).parent().children();return at.call(r,n)},e.closest=function(t){var n=this.filter(t);if(n.length)return n;var r=this.parent();return r.length?r.closest(t):n},e.siblings=function(t){return x(o(w(R(this,function(n){return o(n).parent().children().not(n)}))),t)},e.find=function(t){return o(w(R(this,function(n){return J(t,n)})))};var Kt=/^\s*\s*$/g,Qt=/^$|^module$|\/(java|ecma)script/i,Vt=["type","src","nonce","noModule"];function Zt(t,n){var r=o(t);r.filter("script").add(r.find("script")).each(function(i,u){if(Qt.test(u.type)&&st.contains(u)){var s=L("script");s.text=u.textContent.replace(Kt,""),d(Vt,function(f,a){u[a]&&(s[a]=u[a])}),n.head.insertBefore(s,null),n.head.removeChild(s)}})}function kt(t,n,r,i,u){i?t.insertBefore(n,r?t.firstChild:null):t.nodeName==="HTML"?t.parentNode.replaceChild(n,t):t.parentNode.insertBefore(n,r?t:t.nextSibling),u&&Zt(n,t.ownerDocument)}function N(t,n,r,i,u,s,f,a){return d(t,function(y,h){d(o(h),function(p,O){d(o(n),function(b,W){var rt=r?O:W,it=r?W:O,m=r?p:b;kt(rt,m?it.cloneNode(!0):it,i,u,!m)},a)},f)},s),n}e.after=function(){return N(arguments,this,!1,!1,!1,!0,!0)},e.append=function(){return N(arguments,this,!1,!1,!0)};function tn(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(v(t))return this;var n=/]/.test(t);return this.each(function(r,i){!c(i)||(n?o(i).empty().append(t):i.innerHTML=t)})}e.html=tn,e.appendTo=function(t){return N(arguments,this,!0,!1,!0)},e.wrapInner=function(t){return this.each(function(n,r){var i=o(r),u=i.contents();u.length?u.wrapAll(t):i.append(t)})},e.before=function(){return N(arguments,this,!1,!0)},e.wrapAll=function(t){for(var n=o(t),r=n[0];r.children.length;)r=r.firstElementChild;return this.first().before(n),this.appendTo(r)},e.wrap=function(t){return this.each(function(n,r){var i=o(t)[0];o(r).wrapAll(n?i.cloneNode(!0):i)})},e.insertAfter=function(t){return N(arguments,this,!0,!1,!1,!1,!1,!0)},e.insertBefore=function(t){return N(arguments,this,!0,!0)},e.prepend=function(){return N(arguments,this,!1,!0,!0,!0,!0)},e.prependTo=function(t){return N(arguments,this,!0,!0,!0,!1,!1,!0)},e.contents=function(){return o(w(R(this,function(t){return t.tagName==="IFRAME"?[t.contentDocument]:t.tagName==="TEMPLATE"?t.content.childNodes:t.childNodes})))},e.next=function(t,n,r){return x(o(w(R(this,"nextElementSibling",n,r))),t)},e.nextAll=function(t){return this.next(t,!0)},e.nextUntil=function(t,n){return this.next(n,!0,t)},e.parents=function(t,n){return x(o(w(R(this,"parentElement",!0,n))),t)},e.parentsUntil=function(t,n){return this.parents(n,t)},e.prev=function(t,n,r){return x(o(w(R(this,"previousElementSibling",n,r))),t)},e.prevAll=function(t){return this.prev(t,!0)},e.prevUntil=function(t,n){return this.prev(n,!0,t)},e.map=function(t){return o(Bt.apply([],ct.call(this,function(n,r){return t.call(n,r,n)})))},e.clone=function(){return this.map(function(t,n){return n.cloneNode(!0)})},e.offsetParent=function(){return this.map(function(t,n){for(var r=n.offsetParent;r&&T(r,"position")==="static";)r=r.offsetParent;return r||st})},e.slice=function(t,n){return o(ht.call(this,t,n))};var nn=/-([a-z])/g;function K(t){return t.replace(nn,function(n,r){return r.toUpperCase()})}e.ready=function(t){var n=function(){return setTimeout(t,0,o)};return C.readyState!=="loading"?n():C.addEventListener("DOMContentLoaded",n),this},e.unwrap=function(){return this.parent().each(function(t,n){if(n.tagName!=="BODY"){var r=o(n);r.replaceWith(r.children())}}),this},e.offset=function(){var t=this[0];if(!!t){var n=t.getBoundingClientRect();return{top:n.top+M.pageYOffset,left:n.left+M.pageXOffset}}},e.position=function(){var t=this[0];if(!!t){var n=T(t,"position")==="fixed",r=n?t.getBoundingClientRect():this.offset();if(!n){for(var i=t.ownerDocument,u=t.offsetParent||i.documentElement;(u===i.body||u===i.documentElement)&&T(u,"position")==="static";)u=u.parentNode;if(u!==t&&c(u)){var s=o(u).offset();r.top-=s.top+E(u,"borderTopWidth"),r.left-=s.left+E(u,"borderLeftWidth")}}return{top:r.top-E(t,"marginTop"),left:r.left-E(t,"marginLeft")}}};var Et={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};e.prop=function(t,n){if(!!t){if(g(t))return t=Et[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each(function(i,u){u[t]=n});for(var r in t)this.prop(r,t[r]);return this}},e.removeProp=function(t){return this.each(function(n,r){delete r[Et[t]||t]})};var rn=/^--/;function Q(t){return rn.test(t)}var V={},en=ft.style,un=["webkit","moz","ms"];function sn(t,n){if(n===void 0&&(n=Q(t)),n)return t;if(!V[t]){var r=K(t),i="".concat(r[0].toUpperCase()).concat(r.slice(1)),u="".concat(r," ").concat(un.join("".concat(i," "))).concat(i).split(" ");d(u,function(s,f){if(f in en)return V[t]=f,!1})}return V[t]}var fn={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 wt(t,n,r){return r===void 0&&(r=Q(t)),!r&&!fn[t]&<(n)?"".concat(n,"px"):n}function on(t,n){if(g(t)){var r=Q(t);return t=sn(t,r),arguments.length<2?this[0]&&T(this[0],t,r):t?(n=wt(t,n,r),this.each(function(u,s){!c(s)||(r?s.style.setProperty(t,n):s.style[t]=n)})):this}for(var i in t)this.css(i,t[i]);return this}e.css=on;function Ct(t,n){try{return t(n)}catch{return n}}var an=/^\s+|\s+$/;function St(t,n){var r=t.dataset[n]||t.dataset[K(n)];return an.test(r)?r:Ct(JSON.parse,r)}function cn(t,n,r){r=Ct(JSON.stringify,r),t.dataset[K(n)]=r}function hn(t,n){if(!t){if(!this[0])return;var r={};for(var i in this[0].dataset)r[i]=St(this[0],i);return r}if(g(t))return arguments.length<2?this[0]&&St(this[0],t):v(n)?this:this.each(function(u,s){cn(s,t,n)});for(var i in t)this.data(i,t[i]);return this}e.data=hn;function Tt(t,n){var r=t.documentElement;return Math.max(t.body["scroll".concat(n)],r["scroll".concat(n)],t.body["offset".concat(n)],r["offset".concat(n)],r["client".concat(n)])}d([!0,!1],function(t,n){d(["Width","Height"],function(r,i){var u="".concat(n?"outer":"inner").concat(i);e[u]=function(s){if(!!this[0])return B(this[0])?n?this[0]["inner".concat(i)]:this[0].document.documentElement["client".concat(i)]:D(this[0])?Tt(this[0],i):this[0]["".concat(n?"offset":"client").concat(i)]+(s&&n?E(this[0],"margin".concat(r?"Top":"Left"))+E(this[0],"margin".concat(r?"Bottom":"Right")):0)}})}),d(["Width","Height"],function(t,n){var r=n.toLowerCase();e[r]=function(i){if(!this[0])return v(i)?void 0:this;if(!arguments.length)return B(this[0])?this[0].document.documentElement["client".concat(n)]:D(this[0])?Tt(this[0],n):this[0].getBoundingClientRect()[r]-gt(this[0],!t);var u=parseInt(i,10);return this.each(function(s,f){if(!!c(f)){var a=T(f,"boxSizing");f.style[r]=wt(r,u+(a==="border-box"?gt(f,!t):0))}})}});var Rt="___cd";e.toggle=function(t){return this.each(function(n,r){if(!!c(r)){var i=v(t)?vt(r):t;i?(r.style.display=r[Rt]||"",vt(r)&&(r.style.display=Jt(r.tagName))):(r[Rt]=T(r,"display"),r.style.display="none")}})},e.hide=function(){return this.toggle(!1)},e.show=function(){return this.toggle(!0)};var xt="___ce",Z=".",k={focus:"focusin",blur:"focusout"},Nt={mouseenter:"mouseover",mouseleave:"mouseout"},dn=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function tt(t){return Nt[t]||k[t]||t}function nt(t){var n=t.split(Z);return[n[0],n.slice(1).sort()]}e.trigger=function(t,n){if(g(t)){var r=nt(t),i=r[0],u=r[1],s=tt(i);if(!s)return this;var f=dn.test(s)?"MouseEvents":"HTMLEvents";t=C.createEvent(f),t.initEvent(s,!0,!0),t.namespace=u.join(Z),t.___ot=i}t.___td=n;var a=t.___ot in k;return this.each(function(y,h){a&&A(h[t.___ot])&&(h["___i".concat(t.type)]=!0,h[t.___ot](),h["___i".concat(t.type)]=!1),h.dispatchEvent(t)})};function Lt(t){return t[xt]=t[xt]||{}}function ln(t,n,r,i,u){var s=Lt(t);s[n]=s[n]||[],s[n].push([r,i,u]),t.addEventListener(n,u)}function At(t,n){return!n||!z.call(n,function(r){return t.indexOf(r)<0})}function F(t,n,r,i,u){var s=Lt(t);if(n)s[n]&&(s[n]=s[n].filter(function(f){var a=f[0],y=f[1],h=f[2];if(u&&h.guid!==u.guid||!At(a,r)||i&&i!==y)return!0;t.removeEventListener(n,h)}));else for(n in s)F(t,n,r,i,u)}e.off=function(t,n,r){var i=this;if(v(t))this.each(function(s,f){!c(f)&&!D(f)&&!B(f)||F(f)});else if(g(t))A(n)&&(r=n,n=""),d($(t),function(s,f){var a=nt(f),y=a[0],h=a[1],p=tt(y);i.each(function(O,b){!c(b)&&!D(b)&&!B(b)||F(b,p,h,n,r)})});else for(var u in t)this.off(u,t[u]);return this},e.remove=function(t){return x(this,t).detach().off(),this},e.replaceWith=function(t){return this.before(t).remove()},e.replaceAll=function(t){return o(t).replaceWith(this),this};function gn(t,n,r,i,u){var s=this;if(!g(t)){for(var f in t)this.on(f,n,r,t[f],u);return this}return g(n)||(v(n)||P(n)?n="":v(r)?(r=n,n=""):(i=r,r=n,n="")),A(i)||(i=r,r=void 0),i?(d($(t),function(a,y){var h=nt(y),p=h[0],O=h[1],b=tt(p),W=p in Nt,rt=p in k;!b||s.each(function(it,m){if(!(!c(m)&&!D(m)&&!B(m))){var et=function(l){if(l.target["___i".concat(l.type)])return l.stopImmediatePropagation();if(!(l.namespace&&!At(O,l.namespace.split(Z)))&&!(!n&&(rt&&(l.target!==m||l.___ot===b)||W&&l.relatedTarget&&m.contains(l.relatedTarget)))){var ut=m;if(n){for(var _=l.target;!pt(_,n);)if(_===m||(_=_.parentNode,!_))return;ut=_}Object.defineProperty(l,"currentTarget",{configurable:!0,get:function(){return ut}}),Object.defineProperty(l,"delegateTarget",{configurable:!0,get:function(){return m}}),Object.defineProperty(l,"data",{configurable:!0,get:function(){return r}});var En=i.call(ut,l,l.___td);u&&F(m,b,O,n,et),En===!1&&(l.preventDefault(),l.stopPropagation())}};et.guid=i.guid=i.guid||o.guid++,ln(m,b,O,n,et)}})}),this):this}e.on=gn;function vn(t,n,r,i){return this.on(t,n,r,i,!0)}e.one=vn;var pn=/%20/g,mn=/\r?\n/g;function yn(t,n){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n.replace(mn,`\r -`)).replace(pn,"+"))}var bn=/file|reset|submit|button|image/i,Ot=/radio|checkbox/i;e.serialize=function(){var t="";return this.each(function(n,r){d(r.elements||[r],function(i,u){if(!(u.disabled||!u.name||u.tagName==="FIELDSET"||bn.test(u.type)||Ot.test(u.type)&&!u.checked)){var s=bt(u);if(!v(s)){var f=H(s)?s:[s];d(f,function(a,y){t+=yn(u.name,y)})}}})}),t.slice(1)},typeof exports<"u"?module.exports=o:M.cash=M.$=o})(); +(function(){"use strict";var C=document,M=window,st=C.documentElement,L=C.createElement.bind(C),ft=L("div"),q=L("table"),Mt=L("tbody"),ot=L("tr"),H=Array.isArray,S=Array.prototype,Bt=S.concat,U=S.filter,at=S.indexOf,ct=S.map,Dt=S.push,ht=S.slice,z=S.some,_t=S.splice,Pt=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,Ht=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,It=/<.+>/,$t=/^\w+$/;function J(t,n){var r=jt(n);return!t||!r&&!D(n)&&!c(n)?[]:!r&&Ht.test(t)?n.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!r&&$t.test(t)?n.getElementsByTagName(t):n.querySelectorAll(t)}var dt=function(){function t(n,r){if(n){if(Y(n))return n;var i=n;if(g(n)){var u=(Y(r)?r[0]:r)||C;if(i=Pt.test(n)&&"getElementById"in u?u.getElementById(n.slice(1).replace(/\\/g,"")):It.test(n)?yt(n):J(n,u),!i)return}else if(A(n))return this.ready(n);(i.nodeType||i===M)&&(i=[i]),this.length=i.length;for(var s=0,f=this.length;s]*>/,Gt=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,mt={"*":ft,tr:Mt,td:ot,th:ot,thead:q,tbody:q,tfoot:q};function yt(t){if(!g(t))return[];if(Gt.test(t))return[L(RegExp.$1)];var n=Yt.test(t)&&RegExp.$1,r=mt[n]||mt["*"];return r.innerHTML=t,o(r.childNodes).detach().get()}o.parseHTML=yt,e.has=function(t){var n=g(t)?function(r,i){return J(t,i).length}:function(r,i){return i.contains(t)};return this.filter(n)},e.not=function(t){var n=j(t);return this.filter(function(r,i){return(!g(t)||c(i))&&!n.call(i,r,i)})};function x(t,n,r,i){for(var u=[],s=A(n),f=i&&j(i),a=0,y=t.length;a=0},!0):r.checked=u.indexOf(r.value)>=0}else r.value=v(t)||P(t)?"":t}):this[0]&&bt(this[0])}e.val=Xt,e.is=function(t){var n=j(t);return z.call(this,function(r,i){return n.call(r,i,r)})},o.guid=1;function w(t){return t.length>1?U.call(t,function(n,r,i){return at.call(i,n)===r}):t}o.unique=w,e.add=function(t,n){return o(w(this.get().concat(o(t,n).get())))},e.children=function(t){return R(o(w(x(this,function(n){return n.children}))),t)},e.parent=function(t){return R(o(w(x(this,"parentNode"))),t)},e.index=function(t){var n=t?o(t)[0]:this[0],r=t?this:o(n).parent().children();return at.call(r,n)},e.closest=function(t){var n=this.filter(t);if(n.length)return n;var r=this.parent();return r.length?r.closest(t):n},e.siblings=function(t){return R(o(w(x(this,function(n){return o(n).parent().children().not(n)}))),t)},e.find=function(t){return o(w(x(this,function(n){return J(t,n)})))};var Kt=/^\s*\s*$/g,Qt=/^$|^module$|\/(java|ecma)script/i,Vt=["type","src","nonce","noModule"];function Zt(t,n){var r=o(t);r.filter("script").add(r.find("script")).each(function(i,u){if(Qt.test(u.type)&&st.contains(u)){var s=L("script");s.text=u.textContent.replace(Kt,""),d(Vt,function(f,a){u[a]&&(s[a]=u[a])}),n.head.insertBefore(s,null),n.head.removeChild(s)}})}function kt(t,n,r,i,u){i?t.insertBefore(n,r?t.firstChild:null):t.nodeName==="HTML"?t.parentNode.replaceChild(n,t):t.parentNode.insertBefore(n,r?t:t.nextSibling),u&&Zt(n,t.ownerDocument)}function N(t,n,r,i,u,s,f,a){return d(t,function(y,h){d(o(h),function(p,O){d(o(n),function(b,W){var rt=r?O:W,it=r?W:O,m=r?p:b;kt(rt,m?it.cloneNode(!0):it,i,u,!m)},a)},f)},s),n}e.after=function(){return N(arguments,this,!1,!1,!1,!0,!0)},e.append=function(){return N(arguments,this,!1,!1,!0)};function tn(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(v(t))return this;var n=/]/.test(t);return this.each(function(r,i){c(i)&&(n?o(i).empty().append(t):i.innerHTML=t)})}e.html=tn,e.appendTo=function(t){return N(arguments,this,!0,!1,!0)},e.wrapInner=function(t){return this.each(function(n,r){var i=o(r),u=i.contents();u.length?u.wrapAll(t):i.append(t)})},e.before=function(){return N(arguments,this,!1,!0)},e.wrapAll=function(t){for(var n=o(t),r=n[0];r.children.length;)r=r.firstElementChild;return this.first().before(n),this.appendTo(r)},e.wrap=function(t){return this.each(function(n,r){var i=o(t)[0];o(r).wrapAll(n?i.cloneNode(!0):i)})},e.insertAfter=function(t){return N(arguments,this,!0,!1,!1,!1,!1,!0)},e.insertBefore=function(t){return N(arguments,this,!0,!0)},e.prepend=function(){return N(arguments,this,!1,!0,!0,!0,!0)},e.prependTo=function(t){return N(arguments,this,!0,!0,!0,!1,!1,!0)},e.contents=function(){return o(w(x(this,function(t){return t.tagName==="IFRAME"?[t.contentDocument]:t.tagName==="TEMPLATE"?t.content.childNodes:t.childNodes})))},e.next=function(t,n,r){return R(o(w(x(this,"nextElementSibling",n,r))),t)},e.nextAll=function(t){return this.next(t,!0)},e.nextUntil=function(t,n){return this.next(n,!0,t)},e.parents=function(t,n){return R(o(w(x(this,"parentElement",!0,n))),t)},e.parentsUntil=function(t,n){return this.parents(n,t)},e.prev=function(t,n,r){return R(o(w(x(this,"previousElementSibling",n,r))),t)},e.prevAll=function(t){return this.prev(t,!0)},e.prevUntil=function(t,n){return this.prev(n,!0,t)},e.map=function(t){return o(Bt.apply([],ct.call(this,function(n,r){return t.call(n,r,n)})))},e.clone=function(){return this.map(function(t,n){return n.cloneNode(!0)})},e.offsetParent=function(){return this.map(function(t,n){for(var r=n.offsetParent;r&&T(r,"position")==="static";)r=r.offsetParent;return r||st})},e.slice=function(t,n){return o(ht.call(this,t,n))};var nn=/-([a-z])/g;function K(t){return t.replace(nn,function(n,r){return r.toUpperCase()})}e.ready=function(t){var n=function(){return setTimeout(t,0,o)};return C.readyState!=="loading"?n():C.addEventListener("DOMContentLoaded",n),this},e.unwrap=function(){return this.parent().each(function(t,n){if(n.tagName!=="BODY"){var r=o(n);r.replaceWith(r.children())}}),this},e.offset=function(){var t=this[0];if(t){var n=t.getBoundingClientRect();return{top:n.top+M.pageYOffset,left:n.left+M.pageXOffset}}},e.position=function(){var t=this[0];if(t){var n=T(t,"position")==="fixed",r=n?t.getBoundingClientRect():this.offset();if(!n){for(var i=t.ownerDocument,u=t.offsetParent||i.documentElement;(u===i.body||u===i.documentElement)&&T(u,"position")==="static";)u=u.parentNode;if(u!==t&&c(u)){var s=o(u).offset();r.top-=s.top+E(u,"borderTopWidth"),r.left-=s.left+E(u,"borderLeftWidth")}}return{top:r.top-E(t,"marginTop"),left:r.left-E(t,"marginLeft")}}};var Et={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};e.prop=function(t,n){if(t){if(g(t))return t=Et[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each(function(i,u){u[t]=n});for(var r in t)this.prop(r,t[r]);return this}},e.removeProp=function(t){return this.each(function(n,r){delete r[Et[t]||t]})};var rn=/^--/;function Q(t){return rn.test(t)}var V={},en=ft.style,un=["webkit","moz","ms"];function sn(t,n){if(n===void 0&&(n=Q(t)),n)return t;if(!V[t]){var r=K(t),i="".concat(r[0].toUpperCase()).concat(r.slice(1)),u="".concat(r," ").concat(un.join("".concat(i," "))).concat(i).split(" ");d(u,function(s,f){if(f in en)return V[t]=f,!1})}return V[t]}var fn={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 wt(t,n,r){return r===void 0&&(r=Q(t)),!r&&!fn[t]&<(n)?"".concat(n,"px"):n}function on(t,n){if(g(t)){var r=Q(t);return t=sn(t,r),arguments.length<2?this[0]&&T(this[0],t,r):t?(n=wt(t,n,r),this.each(function(u,s){c(s)&&(r?s.style.setProperty(t,n):s.style[t]=n)})):this}for(var i in t)this.css(i,t[i]);return this}e.css=on;function Ct(t,n){try{return t(n)}catch{return n}}var an=/^\s+|\s+$/;function St(t,n){var r=t.dataset[n]||t.dataset[K(n)];return an.test(r)?r:Ct(JSON.parse,r)}function cn(t,n,r){r=Ct(JSON.stringify,r),t.dataset[K(n)]=r}function hn(t,n){if(!t){if(!this[0])return;var r={};for(var i in this[0].dataset)r[i]=St(this[0],i);return r}if(g(t))return arguments.length<2?this[0]&&St(this[0],t):v(n)?this:this.each(function(u,s){cn(s,t,n)});for(var i in t)this.data(i,t[i]);return this}e.data=hn;function Tt(t,n){var r=t.documentElement;return Math.max(t.body["scroll".concat(n)],r["scroll".concat(n)],t.body["offset".concat(n)],r["offset".concat(n)],r["client".concat(n)])}d([!0,!1],function(t,n){d(["Width","Height"],function(r,i){var u="".concat(n?"outer":"inner").concat(i);e[u]=function(s){if(this[0])return B(this[0])?n?this[0]["inner".concat(i)]:this[0].document.documentElement["client".concat(i)]:D(this[0])?Tt(this[0],i):this[0]["".concat(n?"offset":"client").concat(i)]+(s&&n?E(this[0],"margin".concat(r?"Top":"Left"))+E(this[0],"margin".concat(r?"Bottom":"Right")):0)}})}),d(["Width","Height"],function(t,n){var r=n.toLowerCase();e[r]=function(i){if(!this[0])return v(i)?void 0:this;if(!arguments.length)return B(this[0])?this[0].document.documentElement["client".concat(n)]:D(this[0])?Tt(this[0],n):this[0].getBoundingClientRect()[r]-gt(this[0],!t);var u=parseInt(i,10);return this.each(function(s,f){if(c(f)){var a=T(f,"boxSizing");f.style[r]=wt(r,u+(a==="border-box"?gt(f,!t):0))}})}});var xt="___cd";e.toggle=function(t){return this.each(function(n,r){if(c(r)){var i=v(t)?vt(r):t;i?(r.style.display=r[xt]||"",vt(r)&&(r.style.display=Jt(r.tagName))):(r[xt]=T(r,"display"),r.style.display="none")}})},e.hide=function(){return this.toggle(!1)},e.show=function(){return this.toggle(!0)};var Rt="___ce",Z=".",k={focus:"focusin",blur:"focusout"},Nt={mouseenter:"mouseover",mouseleave:"mouseout"},dn=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function tt(t){return Nt[t]||k[t]||t}function nt(t){var n=t.split(Z);return[n[0],n.slice(1).sort()]}e.trigger=function(t,n){if(g(t)){var r=nt(t),i=r[0],u=r[1],s=tt(i);if(!s)return this;var f=dn.test(s)?"MouseEvents":"HTMLEvents";t=C.createEvent(f),t.initEvent(s,!0,!0),t.namespace=u.join(Z),t.___ot=i}t.___td=n;var a=t.___ot in k;return this.each(function(y,h){a&&A(h[t.___ot])&&(h["___i".concat(t.type)]=!0,h[t.___ot](),h["___i".concat(t.type)]=!1),h.dispatchEvent(t)})};function Lt(t){return t[Rt]=t[Rt]||{}}function ln(t,n,r,i,u){var s=Lt(t);s[n]=s[n]||[],s[n].push([r,i,u]),t.addEventListener(n,u)}function At(t,n){return!n||!z.call(n,function(r){return t.indexOf(r)<0})}function F(t,n,r,i,u){var s=Lt(t);if(n)s[n]&&(s[n]=s[n].filter(function(f){var a=f[0],y=f[1],h=f[2];if(u&&h.guid!==u.guid||!At(a,r)||i&&i!==y)return!0;t.removeEventListener(n,h)}));else for(n in s)F(t,n,r,i,u)}e.off=function(t,n,r){var i=this;if(v(t))this.each(function(s,f){!c(f)&&!D(f)&&!B(f)||F(f)});else if(g(t))A(n)&&(r=n,n=""),d($(t),function(s,f){var a=nt(f),y=a[0],h=a[1],p=tt(y);i.each(function(O,b){!c(b)&&!D(b)&&!B(b)||F(b,p,h,n,r)})});else for(var u in t)this.off(u,t[u]);return this},e.remove=function(t){return R(this,t).detach().off(),this},e.replaceWith=function(t){return this.before(t).remove()},e.replaceAll=function(t){return o(t).replaceWith(this),this};function gn(t,n,r,i,u){var s=this;if(!g(t)){for(var f in t)this.on(f,n,r,t[f],u);return this}return g(n)||(v(n)||P(n)?n="":v(r)?(r=n,n=""):(i=r,r=n,n="")),A(i)||(i=r,r=void 0),i?(d($(t),function(a,y){var h=nt(y),p=h[0],O=h[1],b=tt(p),W=p in Nt,rt=p in k;b&&s.each(function(it,m){if(!(!c(m)&&!D(m)&&!B(m))){var et=function(l){if(l.target["___i".concat(l.type)])return l.stopImmediatePropagation();if(!(l.namespace&&!At(O,l.namespace.split(Z)))&&!(!n&&(rt&&(l.target!==m||l.___ot===b)||W&&l.relatedTarget&&m.contains(l.relatedTarget)))){var ut=m;if(n){for(var _=l.target;!pt(_,n);)if(_===m||(_=_.parentNode,!_))return;ut=_}Object.defineProperty(l,"currentTarget",{configurable:!0,get:function(){return ut}}),Object.defineProperty(l,"delegateTarget",{configurable:!0,get:function(){return m}}),Object.defineProperty(l,"data",{configurable:!0,get:function(){return r}});var bn=i.call(ut,l,l.___td);u&&F(m,b,O,n,et),bn===!1&&(l.preventDefault(),l.stopPropagation())}};et.guid=i.guid=i.guid||o.guid++,ln(m,b,O,n,et)}})}),this):this}e.on=gn;function vn(t,n,r,i){return this.on(t,n,r,i,!0)}e.one=vn;var pn=/\r?\n/g;function mn(t,n){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n.replace(pn,`\r +`)))}var yn=/file|reset|submit|button|image/i,Ot=/radio|checkbox/i;e.serialize=function(){var t="";return this.each(function(n,r){d(r.elements||[r],function(i,u){if(!(u.disabled||!u.name||u.tagName==="FIELDSET"||yn.test(u.type)||Ot.test(u.type)&&!u.checked)){var s=bt(u);if(!v(s)){var f=H(s)?s:[s];d(f,function(a,y){t+=mn(u.name,y)})}}})}),t.slice(1)},typeof exports<"u"?module.exports=o:M.cash=M.$=o})(); diff --git a/dist/cash.ts b/dist/cash.ts index bb0593a..82be8a2 100644 --- a/dist/cash.ts +++ b/dist/cash.ts @@ -2771,12 +2771,11 @@ function one ( this: Cash, eventFullName: Record | string fn.one = one; -const queryEncodeSpaceRe = /%20/g; const queryEncodeCRLFRe = /\r?\n/g; function queryEncode ( prop: string, value: string ): string { - return `&${encodeURIComponent ( prop )}=${encodeURIComponent ( value.replace ( queryEncodeCRLFRe, '\r\n' ) ).replace ( queryEncodeSpaceRe, '+' )}`; + return `&${encodeURIComponent ( prop )}=${encodeURIComponent ( value.replace ( queryEncodeCRLFRe, '\r\n' ) )}`; } diff --git a/package.json b/package.json index 473d898..3a7088c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "cash-dom", "repository": "github:fabiospampinato/cash", "description": "An absurdly small jQuery alternative for modern browsers.", - "version": "8.1.3", + "version": "8.1.4", "license": "MIT", "browser": "./dist/cash.js", "main": "./dist/cash.js", diff --git a/readme.md b/readme.md index caca071..75039b1 100644 --- a/readme.md +++ b/readme.md @@ -31,10 +31,10 @@ If you're migrating from jQuery be sure to read our [migration guide](https://gi ## Usage -Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/8.1.3/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@8.1.3/dist/cash.min.js) and use it like this: +Get Cash from [CloudFlare](https://cdnjs.cloudflare.com/ajax/libs/cash/8.1.4/cash.min.js) or [jsDelivr](https://cdn.jsdelivr.net/npm/cash-dom@8.1.4/dist/cash.min.js) and use it like this: ```html - +