webshims-rails 1.15.5 → 1.15.6

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: 38f62cf267399136bf9d595a21dd08ecab5ce05e
4
- data.tar.gz: 06c7d3129c32b4f13e09e51efe9b3d0fe6bf43e6
3
+ metadata.gz: f2a250a396c3e4575c9554236d514bad8290e5f6
4
+ data.tar.gz: f90db279b3ca307408ff113748796d1e460b82b3
5
5
  SHA512:
6
- metadata.gz: da45e530703f377bb8494449907a6af502a7b8982fc7336da8b7e21d5fc04eab93d9c786fc1ffe74316afabde8b919e010040b448956d05fde1392d0b43511c7
7
- data.tar.gz: 11fba75988dcd55dd5e250ffba765e3db6b3f819c5decb3dc169e66bc614dfd468648c248e9062599503eeabd5d741cdaeeac789521a65ed0b9dc725db897498
6
+ metadata.gz: 0402b922725d3d57f5f8a44de06cb8779591a4e0f32792b031f516fc077701a48a3e69697afa3cb9a0b055fd88b0ce30035c0e6d37828e210121349e4a2a4028
7
+ data.tar.gz: 3aaf77b51124c8aa9d1bd092d7134290e94977c142e70146f3d027cb77670d8e7807a6b71cbc06781b15962afc2aa6602d0cf3560445b8045cc934bb913fdc1c
data/CHANGES.md ADDED
@@ -0,0 +1,3 @@
1
+ 2015-01-04
2
+ -------------------
3
+ * Removed modernizr-custom from documentation, since webshims has removed its custom modernizr build. If your app depends on Modernizr, you'll have to build and include your own version.
@@ -1,6 +1,6 @@
1
1
  module Webshims
2
2
  module Rails
3
- VERSION = "1.15.5"
4
- WEBSHIMS_VERSION = "1.15.5"
3
+ VERSION = "1.15.6"
4
+ WEBSHIMS_VERSION = "1.15.6"
5
5
  end
6
6
  end
data/readme.textile CHANGED
@@ -22,16 +22,13 @@ $.webshims.setOptions('basePath', '/webshims/shims/')
22
22
  h2. Usage
23
23
 
24
24
  1. Add webshims-rails to your Gemfile for bundler: @gem 'webshims-rails'@
25
- 2. Require modernizr and the webshims polyfiller, eg, in your application.js:
25
+ 2. Require the webshims polyfiller, eg, in your application.js:
26
26
 
27
27
  <pre>
28
- //= require webshims/extras/modernizr-custom
29
28
  //= require webshims/polyfiller
30
29
  </pre>
31
30
 
32
- *Update note:* Previous webshims-rails included only the minified versions; this was incorrect, since the dev (unminified) versions should be required by Sprockets and then the Rails asset pipeline will minify as necessary in production. The unminified ('dev') versions have been moved up a directory to simplify the require paths.
33
-
34
- Users of previous webshims-rails versions should update their sprockets requires and webshims options as below (though I'll leave the minified assets in there to prevent errors).
31
+ *Update note:* Previous webshims versions included a custom modernizr build; this was removed in webshims 1.14.6, so the (previously necessary) `require webshims/extras/modernizr-custom` line should be removed, and if your app requires modernizr, you'll have to build and require it yourself.
35
32
 
36
33
  3. In your javascript, after the polyfiller has been required, set the basePath for webshims as shown below, and then call $.webshims.polyfill(); see webshims docs for more options.
37
34
  (Note that this should be run directly, not in a dom-ready block.)
@@ -137,7 +137,7 @@
137
137
  }
138
138
 
139
139
  $.extend(webshims, {
140
- version: '1.15.5',
140
+ version: '1.15.6',
141
141
 
142
142
  cfg: {
143
143
  enhanceAuto: window.Audio && (!window.matchMedia || matchMedia('(min-device-width: 721px)').matches),
@@ -1234,7 +1234,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1234
1234
 
1235
1235
  })();
1236
1236
  });
1237
- ;(function($){
1237
+ (function ($) {
1238
1238
  "use strict";
1239
1239
 
1240
1240
  var isNumber = function(string){
@@ -1854,7 +1854,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
1854
1854
  webshims.isReady('range-ui', true);
1855
1855
  }
1856
1856
  })(window.webshims ? webshims.$ : jQuery);
1857
- ;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
1857
+ webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
1858
1858
  "use strict";
1859
1859
  var curCfg;
1860
1860
  var formcfg = webshims.formcfg;
@@ -2419,9 +2419,9 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2419
2419
  return val;
2420
2420
  },
2421
2421
  month: function(val, opts, noCorrect){
2422
-
2423
- var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
2424
-
2422
+ var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
2423
+ var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
2424
+
2425
2425
  if(p.length == 2 && p[0] && p[1]){
2426
2426
  p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
2427
2427
  p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
@@ -2893,34 +2893,35 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
2893
2893
  var isValue = name == 'value';
2894
2894
  spinBtnProto[name] = function(val, force, isLive){
2895
2895
  var selectionEnd;
2896
- if(isValue){
2897
- this._beforeValue(val);
2898
- } else {
2899
- this.elemHelper.prop(name, val);
2900
- }
2896
+ if(!this._init || force || val || this.options[name] !== val){
2897
+ if(isValue){
2898
+ this._beforeValue(val);
2899
+ } else {
2900
+ this.elemHelper.prop(name, val);
2901
+ }
2901
2902
 
2902
- val = formatVal[this.type](val, this.options);
2903
- if(this.options.splitInput){
2904
- $.each(this.splits, function(i, elem){
2905
- var setOption;
2906
- if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
2907
- $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
2908
- } else {
2909
- $.prop(elem, name, val[i]);
2903
+ val = formatVal[this.type](val, this.options);
2904
+ if(this.options.splitInput){
2905
+ $.each(this.splits, function(i, elem){
2906
+ if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
2907
+ $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
2908
+ } else {
2909
+ $.prop(elem, name, val[i]);
2910
+ }
2911
+ });
2912
+ } else {
2913
+ val = this.toFixed(val);
2914
+ if(isLive && this._getSelectionEnd){
2915
+ selectionEnd = this._getSelectionEnd(val);
2916
+ }
2917
+ this.element.prop(name, val);
2918
+ if(selectionEnd != null){
2919
+ this.element.prop('selectionEnd', selectionEnd);
2910
2920
  }
2911
- });
2912
- } else {
2913
- val = this.toFixed(val);
2914
- if(isLive && this._getSelectionEnd){
2915
- selectionEnd = this._getSelectionEnd(val);
2916
- }
2917
- this.element.prop(name, val);
2918
- if(selectionEnd != null){
2919
- this.element.prop('selectionEnd', selectionEnd);
2920
2921
  }
2922
+ this._propertyChange(name);
2923
+ this.mirrorValidity();
2921
2924
  }
2922
- this._propertyChange(name);
2923
- this.mirrorValidity();
2924
2925
  };
2925
2926
  });
2926
2927
 
@@ -3270,7 +3271,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3270
3271
  } else {
3271
3272
  popover.hide();
3272
3273
  }
3273
- }
3274
+ };
3274
3275
 
3275
3276
 
3276
3277
  options.containerElements.push(popover.element[0]);
@@ -3376,7 +3377,7 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3376
3377
  popover.activeElement.focus();
3377
3378
  }, 4);
3378
3379
  }
3379
- if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
3380
+ if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
3380
3381
  popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
3381
3382
  show();
3382
3383
  }
@@ -3693,7 +3694,11 @@ webshims.register('dom-extend', function($, webshims, window, document, undefine
3693
3694
  $(data.shim.options.containerElements)
3694
3695
  .on({
3695
3696
  'focusin focus focusout blur': function(e){
3696
- e.stopImmediatePropagation();
3697
+ if(e.type == 'focus'){
3698
+ e.stopPropagation();
3699
+ } else {
3700
+ e.stopImmediatePropagation();
3701
+ }
3697
3702
  hasFocus = has[e.type];
3698
3703
  clearTimeout(timer);
3699
3704
  timer = setTimeout(function(){
@@ -618,7 +618,7 @@
618
618
  webshims.isReady('range-ui', true);
619
619
  }
620
620
  })(window.webshims ? webshims.$ : jQuery);
621
- ;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
621
+ webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
622
622
  "use strict";
623
623
  var curCfg;
624
624
  var formcfg = webshims.formcfg;
@@ -1183,9 +1183,9 @@
1183
1183
  return val;
1184
1184
  },
1185
1185
  month: function(val, opts, noCorrect){
1186
-
1187
- var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
1188
-
1186
+ var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
1187
+ var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
1188
+
1189
1189
  if(p.length == 2 && p[0] && p[1]){
1190
1190
  p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
1191
1191
  p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
@@ -1657,34 +1657,35 @@
1657
1657
  var isValue = name == 'value';
1658
1658
  spinBtnProto[name] = function(val, force, isLive){
1659
1659
  var selectionEnd;
1660
- if(isValue){
1661
- this._beforeValue(val);
1662
- } else {
1663
- this.elemHelper.prop(name, val);
1664
- }
1660
+ if(!this._init || force || val || this.options[name] !== val){
1661
+ if(isValue){
1662
+ this._beforeValue(val);
1663
+ } else {
1664
+ this.elemHelper.prop(name, val);
1665
+ }
1665
1666
 
1666
- val = formatVal[this.type](val, this.options);
1667
- if(this.options.splitInput){
1668
- $.each(this.splits, function(i, elem){
1669
- var setOption;
1670
- if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
1671
- $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
1672
- } else {
1673
- $.prop(elem, name, val[i]);
1667
+ val = formatVal[this.type](val, this.options);
1668
+ if(this.options.splitInput){
1669
+ $.each(this.splits, function(i, elem){
1670
+ if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
1671
+ $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
1672
+ } else {
1673
+ $.prop(elem, name, val[i]);
1674
+ }
1675
+ });
1676
+ } else {
1677
+ val = this.toFixed(val);
1678
+ if(isLive && this._getSelectionEnd){
1679
+ selectionEnd = this._getSelectionEnd(val);
1680
+ }
1681
+ this.element.prop(name, val);
1682
+ if(selectionEnd != null){
1683
+ this.element.prop('selectionEnd', selectionEnd);
1674
1684
  }
1675
- });
1676
- } else {
1677
- val = this.toFixed(val);
1678
- if(isLive && this._getSelectionEnd){
1679
- selectionEnd = this._getSelectionEnd(val);
1680
- }
1681
- this.element.prop(name, val);
1682
- if(selectionEnd != null){
1683
- this.element.prop('selectionEnd', selectionEnd);
1684
1685
  }
1686
+ this._propertyChange(name);
1687
+ this.mirrorValidity();
1685
1688
  }
1686
- this._propertyChange(name);
1687
- this.mirrorValidity();
1688
1689
  };
1689
1690
  });
1690
1691
 
@@ -2034,7 +2035,7 @@
2034
2035
  } else {
2035
2036
  popover.hide();
2036
2037
  }
2037
- }
2038
+ };
2038
2039
 
2039
2040
 
2040
2041
  options.containerElements.push(popover.element[0]);
@@ -2140,7 +2141,7 @@
2140
2141
  popover.activeElement.focus();
2141
2142
  }, 4);
2142
2143
  }
2143
- if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
2144
+ if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
2144
2145
  popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
2145
2146
  show();
2146
2147
  }
@@ -2457,7 +2458,11 @@
2457
2458
  $(data.shim.options.containerElements)
2458
2459
  .on({
2459
2460
  'focusin focus focusout blur': function(e){
2460
- e.stopImmediatePropagation();
2461
+ if(e.type == 'focus'){
2462
+ e.stopPropagation();
2463
+ } else {
2464
+ e.stopImmediatePropagation();
2465
+ }
2461
2466
  hasFocus = has[e.type];
2462
2467
  clearTimeout(timer);
2463
2468
  timer = setTimeout(function(){
@@ -614,7 +614,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
614
614
  }
615
615
 
616
616
  });
617
- ;(function($){
617
+ (function ($) {
618
618
  "use strict";
619
619
 
620
620
  var isNumber = function(string){
@@ -1234,7 +1234,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
1234
1234
  webshims.isReady('range-ui', true);
1235
1235
  }
1236
1236
  })(window.webshims ? webshims.$ : jQuery);
1237
- ;webshims.register('form-number-date-ui', function($, webshims, window, document, undefined, options){
1237
+ webshims.register('form-number-date-ui', function ($, webshims, window, document, undefined, options) {
1238
1238
  "use strict";
1239
1239
  var curCfg;
1240
1240
  var formcfg = webshims.formcfg;
@@ -1799,9 +1799,9 @@ webshims.register('form-number-date-api', function($, webshims, window, document
1799
1799
  return val;
1800
1800
  },
1801
1801
  month: function(val, opts, noCorrect){
1802
-
1803
- var p = (!opts.splitInput) ? val.trim().split(/[\.\s-\/\\]+/) : val;
1804
-
1802
+ var regSplit = opts.monthNames == 'monthNamesShort' ? /[\s-\/\\]+/ : /[\.\s-\/\\]+/;
1803
+ var p = (!opts.splitInput) ? val.trim().split(regSplit) : val;
1804
+
1805
1805
  if(p.length == 2 && p[0] && p[1]){
1806
1806
  p[0] = !noCorrect && curCfg.date.monthkeys[p[0]] || p[0];
1807
1807
  p[1] = !noCorrect && curCfg.date.monthkeys[p[1]] || p[1];
@@ -2273,34 +2273,35 @@ webshims.register('form-number-date-api', function($, webshims, window, document
2273
2273
  var isValue = name == 'value';
2274
2274
  spinBtnProto[name] = function(val, force, isLive){
2275
2275
  var selectionEnd;
2276
- if(isValue){
2277
- this._beforeValue(val);
2278
- } else {
2279
- this.elemHelper.prop(name, val);
2280
- }
2276
+ if(!this._init || force || val || this.options[name] !== val){
2277
+ if(isValue){
2278
+ this._beforeValue(val);
2279
+ } else {
2280
+ this.elemHelper.prop(name, val);
2281
+ }
2281
2282
 
2282
- val = formatVal[this.type](val, this.options);
2283
- if(this.options.splitInput){
2284
- $.each(this.splits, function(i, elem){
2285
- var setOption;
2286
- if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
2287
- $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
2288
- } else {
2289
- $.prop(elem, name, val[i]);
2283
+ val = formatVal[this.type](val, this.options);
2284
+ if(this.options.splitInput){
2285
+ $.each(this.splits, function(i, elem){
2286
+ if(!(name in elem) && !isValue && $.nodeName(elem, 'select')){
2287
+ $('option[value="'+ val[i] +'"]', elem).prop('defaultSelected', true);
2288
+ } else {
2289
+ $.prop(elem, name, val[i]);
2290
+ }
2291
+ });
2292
+ } else {
2293
+ val = this.toFixed(val);
2294
+ if(isLive && this._getSelectionEnd){
2295
+ selectionEnd = this._getSelectionEnd(val);
2296
+ }
2297
+ this.element.prop(name, val);
2298
+ if(selectionEnd != null){
2299
+ this.element.prop('selectionEnd', selectionEnd);
2290
2300
  }
2291
- });
2292
- } else {
2293
- val = this.toFixed(val);
2294
- if(isLive && this._getSelectionEnd){
2295
- selectionEnd = this._getSelectionEnd(val);
2296
- }
2297
- this.element.prop(name, val);
2298
- if(selectionEnd != null){
2299
- this.element.prop('selectionEnd', selectionEnd);
2300
2301
  }
2302
+ this._propertyChange(name);
2303
+ this.mirrorValidity();
2301
2304
  }
2302
- this._propertyChange(name);
2303
- this.mirrorValidity();
2304
2305
  };
2305
2306
  });
2306
2307
 
@@ -2650,7 +2651,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
2650
2651
  } else {
2651
2652
  popover.hide();
2652
2653
  }
2653
- }
2654
+ };
2654
2655
 
2655
2656
 
2656
2657
  options.containerElements.push(popover.element[0]);
@@ -2756,7 +2757,7 @@ webshims.register('form-number-date-api', function($, webshims, window, document
2756
2757
  popover.activeElement.focus();
2757
2758
  }, 4);
2758
2759
  }
2759
- if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
2760
+ if(data.element.is(':focus') && !$.nodeName(e.target, 'select')){
2760
2761
  popover.openedByFocus = options.buttonOnly ? false : !options.noInput;
2761
2762
  show();
2762
2763
  }
@@ -3073,7 +3074,11 @@ webshims.register('form-number-date-api', function($, webshims, window, document
3073
3074
  $(data.shim.options.containerElements)
3074
3075
  .on({
3075
3076
  'focusin focus focusout blur': function(e){
3076
- e.stopImmediatePropagation();
3077
+ if(e.type == 'focus'){
3078
+ e.stopPropagation();
3079
+ } else {
3080
+ e.stopImmediatePropagation();
3081
+ }
3077
3082
  hasFocus = has[e.type];
3078
3083
  clearTimeout(timer);
3079
3084
  timer = setTimeout(function(){