vendor/assets/javascripts/webshims/shims/combos/30.js in webshims-rails-1.12.3 vs vendor/assets/javascripts/webshims/shims/combos/30.js in webshims-rails-1.12.5

- old
+ new

@@ -614,11 +614,11 @@ })(), _create: function(){ $.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){ var body = document.body; var doc = document.documentElement; - docObserve[type] = function(){ + docObserve[type] = function (){ return Math.max( body[ "scroll" + name ], doc[ "scroll" + name ], body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); @@ -629,28 +629,15 @@ if(!this.init && document.body){ this.init = true; this._create(); this.height = docObserve.getHeight(); this.width = docObserve.getWidth(); - setInterval(this.test, 600); + setInterval(this.test, 999); $(this.test); webshims.ready('WINDOWLOAD', this.test); $(document).on('updatelayout.webshim pageinit popupafteropen panelbeforeopen tabsactivate collapsibleexpand shown.bs.modal shown.bs.collapse slid.bs.carousel', this.handler); $(window).on('resize', this.handler); - (function(){ - var oldAnimate = $.fn.animate; - var animationTimer; - - $.fn.animate = function(){ - clearTimeout(animationTimer); - animationTimer = setTimeout(function(){ - docObserve.test(); - }, 99); - - return oldAnimate.apply(this, arguments); - }; - })(); } } }; @@ -1141,12 +1128,11 @@ } }); })(); }); -; -webshims.register('form-core', function($, webshims, window, document, undefined, options){ +;webshims.register('form-core', function($, webshims, window, document, undefined, options){ "use strict"; webshims.capturingEventPrevented = function(e){ if(!e._isPolyfilled){ var isDefaultPrevented = e.isDefaultPrevented; @@ -1168,23 +1154,26 @@ if(Modernizr.formvalidation && !webshims.bugs.bustedValidity){ //create delegatable events webshims.capturingEvents(['invalid'], true); } + var modules = webshims.modules; var isValid = function(elem){ return ($.prop(elem, 'validity') || {valid: 1}).valid; }; var lazyLoad = function(){ var toLoad = ['form-validation']; if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); } - if(options.customDatalist){ + + if(webshims._getAutoEnhance(options.customDatalist)){ options.fD = true; toLoad.push('form-datalist'); } + if(options.addValidators){ toLoad.push('form-validators'); } webshims.reTest(toLoad); $(document).off('.lazyloadvalidation'); @@ -1194,11 +1183,11 @@ */ var rElementsGroup = /^(?:form|fieldset)$/i; var hasInvalid = function(elem){ var ret = false; $(elem).jProp('elements').each(function(){ - if(!rElementsGroup.test(elem.nodeName || '')){ + if(!rElementsGroup.test(this.nodeName || '')){ ret = $(this).is(':invalid'); if(ret){ return false; } } @@ -1389,18 +1378,31 @@ if(elem){ message = webshims.getContentValidationMessage(elem, false, key) || $.prop(elem, 'customValidationMessage') || $.prop(elem, 'validationMessage'); } return message; }; + + $.event.special.valuevalidation = { + setup: function(){ + var data = $(this).data() || $.data(this, {}); + if(!('valuevalidation' in data)){ + data.valuevalidation = true; + } + } + }; - $(document).on('focusin.lazyloadvalidation', function(e){ if('form' in e.target){ lazyLoad(); } }); + webshims.ready('WINDOWLOAD', lazyLoad); + + if(modules['form-number-date-ui'].loaded && modules['form-number-date-api'].test()){ + webshims.isReady('form-number-date-ui', true); + } }); ;webshims.register('form-message', function($, webshims, window, document, undefined, options){ "use strict"; if(options.lazyCustomMessages){ options.customMessages = true; @@ -1532,12 +1534,14 @@ var type, widget; if(message && message.indexOf('{%') != -1){ ['value', 'min', 'max', 'title', 'maxlength', 'minlength', 'label'].forEach(function(attr){ if(message.indexOf('{%'+attr) === -1){return;} var val = ((attr == 'label') ? $.trim($('label[for="'+ elem.id +'"]', elem.form).text()).replace(/\*$|:$/, '') : $.prop(elem, attr)) || ''; + val = ''+val; if(name == 'patternMismatch' && attr == 'title' && !val){ webshims.error('no title for patternMismatch provided. Always add a title attribute.'); } + if(valueVals[attr]){ if(!widget){ widget = $(elem).getShadowElement().data('wsWidget'+ (type = $.prop(elem, 'type'))); } if(widget && widget.formatValue){ \ No newline at end of file