vendor/assets/javascripts/webshims/shims/combos/15.js in webshims-rails-1.14.6 vs vendor/assets/javascripts/webshims/shims/combos/15.js in webshims-rails-1.15.2

- old
+ new

@@ -62,17 +62,13 @@ var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized; var has = Object.prototype.hasOwnProperty; webshims.assumeARIA = true; if($('<input type="email" />').attr('type') == 'text' || $('<form />').attr('novalidate') === "" || ('required' in $('<input />')[0].attributes)){ - webshims.error("IE browser modes are busted in IE10+. Please test your HTML/CSS/JS with a real IE version or at least IETester or similiar tools"); + webshims.error("IE browser modes are busted in IE10+. Make sure to run IE in edge mode (X-UA-Compatible). Please test your HTML/CSS/JS with a real IE version or at least IETester or similar tools. "); } - if('debug' in webshims){ - webshims.error('Use webshims.setOptions("debug", true||false||"noCombo"); to debug flag'); - } - if (!webshims.cfg.no$Switch) { var switch$ = function(){ if (window.jQuery && (!window.$ || window.jQuery == window.$) && !window.jQuery.webshims) { webshims.error("jQuery was included more than once. Make sure to include it only once or try the $.noConflict(extreme) feature! Webshims and other Plugins might not work properly. Or set webshims.cfg.no$Switch to 'true'."); if (window.$) { @@ -679,38 +675,42 @@ } else { docObserve.runs = 0; } }, handler: (function(){ + var evt; var trigger = function(){ - $(document).triggerHandler('updateshadowdom'); + $(document).triggerHandler('updateshadowdom', [evt]); }; - return function(e){ - clearTimeout(resizeTimer); - resizeTimer = setTimeout(function(){ - if(e.type == 'resize'){ - var width = $window.width(); - var height = $window.width(); + var timed = function(){ + if(evt && evt.type == 'resize'){ + var width = $window.width(); + var height = $window.width(); - if(height == lastHeight && width == lastWidth){ - return; - } - lastHeight = height; - lastWidth = width; - - docObserve.height = docObserve.getHeight(); - docObserve.width = docObserve.getWidth(); + if(height == lastHeight && width == lastWidth){ + return; } + lastHeight = height; + lastWidth = width; + } - if(window.requestAnimationFrame){ - requestAnimationFrame(trigger); - } else { - setTimeout(trigger, 0); - } - - }, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9); + if(evt && evt.type != 'docresize'){ + docObserve.height = docObserve.getHeight(); + docObserve.width = docObserve.getWidth(); + } + + if(window.requestAnimationFrame){ + requestAnimationFrame(trigger); + } else { + setTimeout(trigger, 0); + } }; + return function(e){ + clearTimeout(resizeTimer); + evt = e; + resizeTimer = setTimeout(timed, (e.type == 'resize' && !window.requestAnimationFrame) ? 50 : 9); + }; })(), _create: function(){ $.each({ Height: "getHeight", Width: "getWidth" }, function(name, type){ var body = document.body; var doc = document.documentElement; @@ -1530,24 +1530,10 @@ if(document.querySelector('.ws-custom-file')){ webshims.reTest(['form-validation']); } }); - $(function(){ - var fileReaderReady = ('FileReader' in window && 'FormData' in window); - if(!fileReaderReady){ - webshims.addReady(function(context){ - if(!fileReaderReady && !modules.filereader.loaded && !modules.moxie.loaded){ - if(context.querySelector('input.ws-filereader')){ - webshims.reTest(['filereader', 'moxie']); - fileReaderReady = true; - } - } - }); - } - }); - if(options.addValidators && options.fastValidators){ webshims.reTest(['form-validators', 'form-validation']); } if(document.readyState == 'complete'){ @@ -1651,11 +1637,10 @@ } return false; }; var emptyJ = $([]); -//TODO: cache + perftest var getGroupElements = function(elem){ elem = $(elem); var name, form; var ret = emptyJ; if(elem[0].type == 'radio'){ @@ -1721,10 +1706,10 @@ ; $.each({tooShort: ['minLength', -1], tooLong: ['maxLength', 1]}, function(name, props){ validityRules[name] = function(input, val, cache){ //defaultValue is not the same as dirty flag, but very similiar - if(cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;} + if(!val || cache.nodeName == 'select' || input.prop('defaultValue') == val){return false;} cacheType(cache, input[0]); if(!lengthTypes[cache.type]){return false;} var prop = input.prop(props[0]);