cash-rails 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23bed224de3bcc6682fae58f9ac4fa1124648a37
4
- data.tar.gz: 12632e515381025e748539db49eedaaa7361b8f0
3
+ metadata.gz: 92d626ab10c7ed9d0b7393eb58ae28649f7640d6
4
+ data.tar.gz: 47a544d884c15228b1e62ff4935545e62c2a7d59
5
5
  SHA512:
6
- metadata.gz: 63c45c51110a2150000f769502674b22f1d791a8734899a2896276c1b2c9ce45cb88b504eb3713d5cc102fc848beceeef4bebb47e1741b9767d74fa600337eff
7
- data.tar.gz: f885025566767eb45fa2ca42a6bb2a994a03d5b6eb216caab7fc97895a2b3ca87febd3080da447bd954e91b359a58886915ca0b1c5d4f17938338a185be5b9d3
6
+ metadata.gz: 0df648f2b3b93ec272e32c331f664b4e07fd1f4549f9ebc130d56028f543e693ae2f7d02b2ef0fe4bacd4b828e0cb7a3963772a8ee8b9d69fdec7235d17cb7f1
7
+ data.tar.gz: e0cd06e54ce12c734273d3ac86e3f44d8fd90dbb49e08d142726b73527290328d8fd29c6da93db9e3c57e00a035ec0344f6d2179d13df6ce5486cd7fcce3b3d3
@@ -1,5 +1,5 @@
1
1
  module Cash
2
2
  module Rails
3
- VERSION = '1.3.4'
3
+ VERSION = '1.3.5'
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- /*! cash-dom 1.3.4, https://github.com/kenwheeler/cash @license MIT */
4
- (function (root, factory) {
3
+ /*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */
4
+ ;(function (root, factory) {
5
5
  if (typeof define === "function" && define.amd) {
6
6
  define(factory);
7
7
  } else if (typeof exports !== "undefined") {
@@ -13,7 +13,8 @@
13
13
  var doc = document, win = window, ArrayProto = Array.prototype, slice = ArrayProto.slice, filter = ArrayProto.filter, push = ArrayProto.push;
14
14
 
15
15
  var noop = function () {}, isFunction = function (item) {
16
- return typeof item === typeof noop;
16
+ // @see https://crbug.com/568448
17
+ return typeof item === typeof noop && item.call;
17
18
  }, isString = function (item) {
18
19
  return typeof item === typeof "";
19
20
  };
@@ -26,12 +27,18 @@
26
27
  return elems;
27
28
  }
28
29
 
29
- var frag, tmp;
30
+ var frag;
30
31
  function parseHTML(str) {
31
- frag = frag || doc.createDocumentFragment();
32
- tmp = tmp || frag.appendChild(doc.createElement("div"));
33
- tmp.innerHTML = str;
34
- return tmp.childNodes;
32
+ if (!frag) {
33
+ frag = doc.implementation.createHTMLDocument();
34
+ var base = frag.createElement("base");
35
+ base.href = doc.location.href;
36
+ frag.head.appendChild(base);
37
+ }
38
+
39
+ frag.body.innerHTML = str;
40
+
41
+ return frag.body.childNodes;
35
42
  }
36
43
 
37
44
  function onReady(fn) {
@@ -92,7 +99,6 @@
92
99
  }
93
100
 
94
101
  var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line
95
- constructor: cash,
96
102
  cash: true,
97
103
  length: 0,
98
104
  push: push,
@@ -101,6 +107,8 @@
101
107
  init: Init
102
108
  };
103
109
 
110
+ Object.defineProperty(fn, "constructor", { value: cash });
111
+
104
112
  cash.parseHTML = parseHTML;
105
113
  cash.noop = noop;
106
114
  cash.isFunction = isFunction;
@@ -145,6 +153,20 @@
145
153
  return !!m && m.call(el, selector);
146
154
  }
147
155
 
156
+ function getCompareFunction(selector) {
157
+ return (
158
+ /* Use browser's `matches` function if string */
159
+ isString(selector) ? matches :
160
+ /* Match a cash element */
161
+ selector.cash ? function (el) {
162
+ return selector.is(el);
163
+ } :
164
+ /* Direct comparison */
165
+ function (el, selector) {
166
+ return el === selector;
167
+ });
168
+ }
169
+
148
170
  function unique(collection) {
149
171
  return cash(slice.call(collection).filter(function (item, index, self) {
150
172
  return self.indexOf(item) === index;
@@ -374,9 +396,15 @@
374
396
  },
375
397
 
376
398
  filter: function (selector) {
377
- return cash(filter.call(this, (isString(selector) ? function (e) {
378
- return matches(e, selector);
379
- } : selector)));
399
+ if (!selector) {
400
+ return this;
401
+ }
402
+
403
+ var comparator = (isFunction(selector) ? selector : getCompareFunction(selector));
404
+
405
+ return cash(filter.call(this, function (e) {
406
+ return comparator(e, selector);
407
+ }));
380
408
  },
381
409
 
382
410
  first: function () {
@@ -481,9 +509,18 @@
481
509
  }
482
510
 
483
511
  function removeEvent(node, eventName, callback) {
484
- var eventCache = getData(node, "_cashEvents")[eventName];
512
+ var events = getData(node, "_cashEvents"), eventCache = (events && events[eventName]), index;
513
+
514
+ if (!eventCache) {
515
+ return;
516
+ }
517
+
485
518
  if (callback) {
486
519
  node.removeEventListener(eventName, callback);
520
+ index = eventCache.indexOf(callback);
521
+ if (index >= 0) {
522
+ eventCache.splice(index, 1);
523
+ }
487
524
  } else {
488
525
  each(eventCache, function (event) {
489
526
  node.removeEventListener(eventName, event);
@@ -571,27 +608,69 @@
571
608
  function encode(name, value) {
572
609
  return "&" + encodeURIComponent(name) + "=" + encodeURIComponent(value).replace(/%20/g, "+");
573
610
  }
574
- function isCheckable(field) {
575
- return field.type === "radio" || field.type === "checkbox";
611
+
612
+ function getSelectMultiple_(el) {
613
+ var values = [];
614
+ each(el.options, function (o) {
615
+ if (o.selected) {
616
+ values.push(o.value);
617
+ }
618
+ });
619
+ return values.length ? values : null;
576
620
  }
577
621
 
578
- var formExcludes = ["file", "reset", "submit", "button"];
622
+ function getSelectSingle_(el) {
623
+ var selectedIndex = el.selectedIndex;
624
+ return selectedIndex >= 0 ? el.options[selectedIndex].value : null;
625
+ }
626
+
627
+ function getValue(el) {
628
+ var type = el.type;
629
+ if (!type) {
630
+ return null;
631
+ }
632
+ switch (type.toLowerCase()) {
633
+ case "select-one":
634
+ return getSelectSingle_(el);
635
+ case "select-multiple":
636
+ return getSelectMultiple_(el);
637
+ case "radio":
638
+ return (el.checked) ? el.value : null;
639
+ case "checkbox":
640
+ return (el.checked) ? el.value : null;
641
+ default:
642
+ return el.value ? el.value : null;
643
+ }
644
+ }
579
645
 
580
646
  fn.extend({
581
647
  serialize: function () {
582
- var formEl = this[0].elements, query = "";
583
-
584
- each(formEl, function (field) {
585
- if (field.name && formExcludes.indexOf(field.type) < 0) {
586
- if (field.type === "select-multiple") {
587
- each(field.options, function (o) {
588
- if (o.selected) {
589
- query += encode(field.name, o.value);
590
- }
591
- });
592
- } else if (!isCheckable(field) || (isCheckable(field) && field.checked)) {
593
- query += encode(field.name, field.value);
594
- }
648
+ var query = "";
649
+
650
+ each(this[0].elements || this, function (el) {
651
+ if (el.disabled || el.tagName === "FIELDSET") {
652
+ return;
653
+ }
654
+ var name = el.name;
655
+ switch (el.type.toLowerCase()) {
656
+ case "file":
657
+ case "reset":
658
+ case "submit":
659
+ case "button":
660
+ break;
661
+ case "select-multiple":
662
+ var values = getValue(el);
663
+ if (values !== null) {
664
+ each(values, function (value) {
665
+ query += encode(name, value);
666
+ });
667
+ }
668
+ break;
669
+ default:
670
+ var value = getValue(el);
671
+ if (value !== null) {
672
+ query += encode(name, value);
673
+ }
595
674
  }
596
675
  });
597
676
 
@@ -600,7 +679,7 @@
600
679
 
601
680
  val: function (value) {
602
681
  if (value === undefined) {
603
- return this[0].value;
682
+ return getValue(this[0]);
604
683
  } else {
605
684
  return this.each(function (v) {
606
685
  return v.value = value;
@@ -755,10 +834,6 @@
755
834
 
756
835
  });
757
836
 
758
- function directCompare(el, selector) {
759
- return el === selector;
760
- }
761
-
762
837
  fn.extend({
763
838
  children: function (selector) {
764
839
  var elems = [];
@@ -773,8 +848,11 @@
773
848
  },
774
849
 
775
850
  closest: function (selector) {
776
- if (!selector || matches(this[0], selector)) {
777
- return this;
851
+ if (!selector || this.length < 1) {
852
+ return cash();
853
+ }
854
+ if (this.is(selector)) {
855
+ return this.filter(selector);
778
856
  }
779
857
  return this.parent().closest(selector);
780
858
  },
@@ -784,12 +862,10 @@
784
862
  return false;
785
863
  }
786
864
 
787
- var match = false, comparator = (isString(selector) ? matches : selector.cash ? function (el) {
788
- return selector.is(el);
789
- } : directCompare);
865
+ var match = false, comparator = getCompareFunction(selector);
790
866
 
791
- this.each(function (el, i) {
792
- match = comparator(el, selector, i);
867
+ this.each(function (el) {
868
+ match = comparator(el, selector);
793
869
  return !match;
794
870
  });
795
871
 
@@ -797,8 +873,8 @@
797
873
  },
798
874
 
799
875
  find: function (selector) {
800
- if (!selector) {
801
- return cash();
876
+ if (!selector || selector.nodeType) {
877
+ return cash(selector && this.has(selector).length ? selector : null);
802
878
  }
803
879
 
804
880
  var elems = [];
@@ -810,9 +886,13 @@
810
886
  },
811
887
 
812
888
  has: function (selector) {
813
- return filter.call(this, function (el) {
814
- return cash(el).find(selector).length !== 0;
889
+ var comparator = (isString(selector) ? function (el) {
890
+ return find(selector, el).length !== 0;
891
+ } : function (el) {
892
+ return el.contains(selector);
815
893
  });
894
+
895
+ return this.filter(comparator);
816
896
  },
817
897
 
818
898
  next: function () {
@@ -820,14 +900,24 @@
820
900
  },
821
901
 
822
902
  not: function (selector) {
823
- return filter.call(this, function (el) {
824
- return !matches(el, selector);
903
+ if (!selector) {
904
+ return this;
905
+ }
906
+
907
+ var comparator = getCompareFunction(selector);
908
+
909
+ return this.filter(function (el) {
910
+ return !comparator(el, selector);
825
911
  });
826
912
  },
827
913
 
828
914
  parent: function () {
829
- var result = this.map(function (item) {
830
- return item.parentElement || doc.body.parentNode;
915
+ var result = [];
916
+
917
+ this.each(function (item) {
918
+ if (item && item.parentNode) {
919
+ result.push(item.parentNode);
920
+ }
831
921
  });
832
922
 
833
923
  return unique(result);
@@ -839,8 +929,8 @@
839
929
  this.each(function (item) {
840
930
  last = item;
841
931
 
842
- while (last !== doc.body.parentNode) {
843
- last = last.parentElement;
932
+ while (last && last.parentNode && last !== doc.body.parentNode) {
933
+ last = last.parentNode;
844
934
 
845
935
  if (!selector || (selector && matches(last, selector))) {
846
936
  result.push(last);
@@ -858,7 +948,7 @@
858
948
  siblings: function () {
859
949
  var collection = this.parent().children(), el = this[0];
860
950
 
861
- return filter.call(collection, function (i) {
951
+ return collection.filter(function (i) {
862
952
  return i !== el;
863
953
  });
864
954
  }
@@ -1,2 +1 @@
1
- "use strict";/*! cash-dom 1.3.4, https://github.com/kenwheeler/cash @license MIT */
2
- !function(t,n){"function"==typeof define&&define.amd?define(n):"undefined"!=typeof exports?module.exports=n():t.cash=t.$=n()}(this,function(){function t(t,n){n=n||w;var e=$.test(t)?n.getElementsByClassName(t.slice(1)):k.test(t)?n.getElementsByTagName(t):n.querySelectorAll(t);return e}function n(t){return E=E||w.createDocumentFragment(),A=A||E.appendChild(w.createElement("div")),A.innerHTML=t,A.childNodes}function e(t){"loading"!==w.readyState?t():w.addEventListener("DOMContentLoaded",t)}function r(r,i){if(!r)return this;if(r.cash&&r!==T)return r;var o,u=r,s=0;if(q(r))u=P.test(r)?w.getElementById(r.slice(1)):_.test(r)?n(r):t(r,i);else if(R(r))return e(r),this;if(!u)return this;if(u.nodeType||u===T)this[0]=u,this.length=1;else for(o=this.length=u.length;o>s;s++)this[s]=u[s];return this}function i(t,n){return new r(t,n)}function o(t,n){for(var e=t.length,r=0;e>r&&n.call(t[r],t[r],r,t)!==!1;r++);}function u(t,n){var e=t&&(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector);return!!e&&e.call(t,n)}function s(t){return i(M.call(t).filter(function(t,n,e){return e.indexOf(t)===n}))}function c(t){return t[F]=t[F]||{}}function a(t,n,e){return c(t)[n]=e}function f(t,n){var e=c(t);return void 0===e[n]&&(e[n]=t.dataset?t.dataset[n]:i(t).attr("data-"+n)),e[n]}function h(t,n){var e=c(t);e?delete e[n]:t.dataset?delete t.dataset[n]:i(t).removeAttr("data-"+name)}function l(t){return q(t)&&t.match(I)}function d(t,n){return t.classList?t.classList.contains(n):new RegExp("(^| )"+n+"( |$)","gi").test(t.className)}function p(t,n,e){t.classList?t.classList.add(n):e.indexOf(" "+n+" ")&&(t.className+=" "+n)}function v(t,n){t.classList?t.classList.remove(n):t.className=t.className.replace(n,"")}function m(t,n){return parseInt(T.getComputedStyle(t[0],null)[n],10)||0}function g(t,n,e){var r=f(t,"_cashEvents")||a(t,"_cashEvents",{});r[n]=r[n]||[],r[n].push(e),t.addEventListener(n,e)}function y(t,n,e){var r=f(t,"_cashEvents")[n];e?t.removeEventListener(n,e):(o(r,function(e){t.removeEventListener(n,e)}),r=[])}function x(t,n){return"&"+encodeURIComponent(t)+"="+encodeURIComponent(n).replace(/%20/g,"+")}function C(t){return"radio"===t.type||"checkbox"===t.type}function L(t,n,e){if(e){var r=t.childNodes[0];t.insertBefore(n,r)}else t.appendChild(n)}function N(t,n,e){var r=q(n);return!r&&n.length?void o(n,function(n){return N(t,n,e)}):void o(t,r?function(t){return t.insertAdjacentHTML(e?"afterbegin":"beforeend",n)}:function(t,r){return L(t,0===r?n:n.cloneNode(!0),e)})}function b(t,n){return t===n}var E,A,w=document,T=window,S=Array.prototype,M=S.slice,B=S.filter,H=S.push,O=function(){},R=function(t){return typeof t==typeof O},q=function(t){return"string"==typeof t},P=/^#[\w-]*$/,$=/^\.[\w-]*$/,_=/<.+>/,k=/^\w+$/,D=i.fn=i.prototype=r.prototype={constructor:i,cash:!0,length:0,push:H,splice:S.splice,map:S.map,init:r};i.parseHTML=n,i.noop=O,i.isFunction=R,i.isString=q,i.extend=D.extend=function(t){t=t||{};var n=M.call(arguments),e=n.length,r=1;for(1===n.length&&(t=this,r=0);e>r;r++)if(n[r])for(var i in n[r])n[r].hasOwnProperty(i)&&(t[i]=n[r][i]);return t},i.extend({merge:function(t,n){for(var e=+n.length,r=t.length,i=0;e>i;r++,i++)t[r]=n[i];return t.length=r,t},each:o,matches:u,unique:s,isArray:Array.isArray,isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)}});var F=i.uid="_cash"+Date.now();D.extend({data:function(t,n){if(q(t))return void 0===n?f(this[0],t):this.each(function(e){return a(e,t,n)});for(var e in t)this.data(e,t[e]);return this},removeData:function(t){return this.each(function(n){return h(n,t)})}});var I=/\S+/g;D.extend({addClass:function(t){var n=l(t);return n?this.each(function(t){var e=" "+t.className+" ";o(n,function(n){p(t,n,e)})}):this},attr:function(t,n){if(t){if(q(t))return void 0===n?this[0]?this[0].getAttribute?this[0].getAttribute(t):this[0][t]:void 0:this.each(function(e){e.setAttribute?e.setAttribute(t,n):e[t]=n});for(var e in t)this.attr(e,t[e]);return this}},hasClass:function(t){var n=!1,e=l(t);return e&&e.length&&this.each(function(t){return n=d(t,e[0]),!n}),n},prop:function(t,n){if(q(t))return void 0===n?this[0][t]:this.each(function(e){e[t]=n});for(var e in t)this.prop(e,t[e]);return this},removeAttr:function(t){return this.each(function(n){n.removeAttribute?n.removeAttribute(t):delete n[t]})},removeClass:function(t){if(!arguments.length)return this.attr("class","");var n=l(t);return n?this.each(function(t){o(n,function(n){v(t,n)})}):this},removeProp:function(t){return this.each(function(n){delete n[t]})},toggleClass:function(t,n){if(void 0!==n)return this[n?"addClass":"removeClass"](t);var e=l(t);return e?this.each(function(t){var n=" "+t.className+" ";o(e,function(e){d(t,e)?v(t,e):p(t,e,n)})}):this}}),D.extend({add:function(t,n){return s(i.merge(this,i(t,n)))},each:function(t){return o(this,t),this},eq:function(t){return i(this.get(t))},filter:function(t){return i(B.call(this,q(t)?function(n){return u(n,t)}:t))},first:function(){return this.eq(0)},get:function(t){return void 0===t?M.call(this):0>t?this[t+this.length]:this[t]},index:function(t){var n=t?i(t)[0]:this[0],e=t?this:i(n).parent().children();return M.call(e).indexOf(n)},last:function(){return this.eq(-1)}});var U=function(){var t=/(?:^\w|[A-Z]|\b\w)/g,n=/[\s-_]+/g;return function(e){return e.replace(t,function(t,n){return t[0===n?"toLowerCase":"toUpperCase"]()}).replace(n,"")}}(),z=function(){var t={},n=document,e=n.createElement("div"),r=e.style;return function(n){if(n=U(n),t[n])return t[n];var e=n.charAt(0).toUpperCase()+n.slice(1),i=["webkit","moz","ms","o"],u=(n+" "+i.join(e+" ")+e).split(" ");return o(u,function(e){return e in r?(t[e]=n=t[n]=e,!1):void 0}),t[n]}}();i.prefixedProp=z,i.camelCase=U,D.extend({css:function(t,n){if(q(t))return t=z(t),arguments.length>1?this.each(function(e){return e.style[t]=n}):T.getComputedStyle(this[0])[t];for(var e in t)this.css(e,t[e]);return this}}),o(["Width","Height"],function(t){var n=t.toLowerCase();D[n]=function(){return this[0].getBoundingClientRect()[n]},D["inner"+t]=function(){return this[0]["client"+t]},D["outer"+t]=function(n){return this[0]["offset"+t]+(n?m(this,"margin"+("Width"===t?"Left":"Top"))+m(this,"margin"+("Width"===t?"Right":"Bottom")):0)}}),D.extend({off:function(t,n){return this.each(function(e){return y(e,t,n)})},on:function(t,n,r,i){var o;if(!q(t)){for(var s in t)this.on(s,n,t[s]);return this}return R(n)&&(r=n,n=null),"ready"===t?(e(r),this):(n&&(o=r,r=function(t){for(var e=t.target;!u(e,n);){if(e===this)return e=!1;e=e.parentNode}e&&o.call(e,t)}),this.each(function(n){var e=r;i&&(e=function(){r.apply(this,arguments),y(n,t,e)}),g(n,t,e)}))},one:function(t,n,e){return this.on(t,n,e,!0)},ready:e,trigger:function(t,n){var e=w.createEvent("HTMLEvents");return e.data=n,e.initEvent(t,!0,!1),this.each(function(t){return t.dispatchEvent(e)})}});var W=["file","reset","submit","button"];D.extend({serialize:function(){var t=this[0].elements,n="";return o(t,function(t){t.name&&W.indexOf(t.type)<0&&("select-multiple"===t.type?o(t.options,function(e){e.selected&&(n+=x(t.name,e.value))}):(!C(t)||C(t)&&t.checked)&&(n+=x(t.name,t.value)))}),n.substr(1)},val:function(t){return void 0===t?this[0].value:this.each(function(n){return n.value=t})}}),D.extend({after:function(t){return i(t).insertAfter(this),this},append:function(t){return N(this,t),this},appendTo:function(t){return N(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 n=t.nodeType?t[0].outerHTML:t;return this.each(function(t){return t.innerHTML=n})},insertAfter:function(t){var n=this;return i(t).each(function(t,e){var r=t.parentNode,i=t.nextSibling;n.each(function(t){r.insertBefore(0===e?t:t.cloneNode(!0),i)})}),this},insertBefore:function(t){var n=this;return i(t).each(function(t,e){var r=t.parentNode;n.each(function(n){r.insertBefore(0===e?n:n.cloneNode(!0),t)})}),this},prepend:function(t){return N(this,t,!0),this},prependTo:function(t){return N(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(n){return n.textContent=t})}});var j=w.documentElement;return D.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+T.pageYOffset-j.clientTop,left:t.left+T.pageXOffset-j.clientLeft}},offsetParent:function(){return i(this[0].offsetParent)}}),D.extend({children:function(t){var n=[];return this.each(function(t){H.apply(n,t.children)}),n=s(n),t?n.filter(function(n){return u(n,t)}):n},closest:function(t){return!t||u(this[0],t)?this:this.parent().closest(t)},is:function(t){if(!t)return!1;var n=!1,e=q(t)?u:t.cash?function(n){return t.is(n)}:b;return this.each(function(r,i){return n=e(r,t,i),!n}),n},find:function(n){if(!n)return i();var e=[];return this.each(function(r){H.apply(e,t(n,r))}),s(e)},has:function(t){return B.call(this,function(n){return 0!==i(n).find(t).length})},next:function(){return i(this[0].nextElementSibling)},not:function(t){return B.call(this,function(n){return!u(n,t)})},parent:function(){var t=this.map(function(t){return t.parentElement||w.body.parentNode});return s(t)},parents:function(t){var n,e=[];return this.each(function(r){for(n=r;n!==w.body.parentNode;)n=n.parentElement,(!t||t&&u(n,t))&&e.push(n)}),s(e)},prev:function(){return i(this[0].previousElementSibling)},siblings:function(){var t=this.parent().children(),n=this[0];return B.call(t,function(t){return t!==n})}}),i});
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});
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cash-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Jagusch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-05 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.6.4
81
+ rubygems_version: 2.6.7
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: cash a jQuery alternative