vendor/assets/javascripts/webshims/shims/combos/15.js in webshims-rails-1.10.9 vs vendor/assets/javascripts/webshims/shims/combos/15.js in webshims-rails-1.10.10

- old
+ new

@@ -10,18 +10,18 @@ if(!$.parseHTML){ webshims.error("Webshims needs jQuery 1.8+ to work properly. Please update your jQuery version or downgrade webshims."); } - if(webshims.cfg.extendNative == 1){ + if(webshims.cfg.extendNative === 1){ webshims.warn("extendNative configuration will be set to false by default with next release. In case you rely on it set it to 'true' otherwise to 'false'. See http://bit.ly/16OOTQO"); } 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.."); + 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.$) { window.$ = webshims.$; } window.jQuery = webshims.$; } @@ -559,10 +559,11 @@ this.height = docObserve.getHeight(); this.width = docObserve.getWidth(); setInterval(this.test, 600); $(this.test); webshims.ready('WINDOWLOAD', this.test); + $(document).on('updatelayout', this.handler); $(window).bind('resize', this.handler); (function(){ var oldAnimate = $.fn.animate; var animationTimer; @@ -606,11 +607,13 @@ shadowFocusElementData = $.data(opts.shadowFocusElement, dataID) || $.data(opts.shadowFocusElement, dataID, shadowFocusElementData); } $(nativeElem).on('remove', function(e){ if (!e.originalEvent) { - $(shadowElem).remove(); + setTimeout(function(){ + $(shadowElem).remove(); + }, 4); } }); nativeData.hasShadow = shadowElem; shadowFocusElementData.nativeElement = shadowData.nativeElement = nativeElem; @@ -1084,11 +1087,11 @@ addRole(footer, 'contentinfo'); } } }); -})(jQuery, document); +})(webshims.$, document); webshims.register('form-core', function($, webshims, window, document, undefined, options){ "use strict"; webshims.capturingEventPrevented = function(e){ @@ -1163,10 +1166,11 @@ ['valid', 'invalid', 'required', 'optional'].forEach(function(name){ $.expr[":"][name] = $.expr.filters[name+"-element"]; }); + //bug was partially fixed in 1.10.0 for IE9, but not IE8 (move to es5 as soon as 1.10.2 is used) var pseudoFocus = $.expr[":"].focus; $.expr[":"].focus = function(){ try { return pseudoFocus.apply(this, arguments); } catch(e){ @@ -1185,14 +1189,22 @@ obj[fn].apply(obj, args); }); }; var transClass = ('transitionDelay' in document.documentElement.style) ? '' : ' no-transition'; + var poCFG = webshims.cfg.wspopover; + if(!poCFG.position && poCFG.position !== false){ + poCFG.position = { + at: 'left bottom', + my: 'left top', + collision: 'fit flip' + }; + } webshims.wsPopover = { id: 0, _create: function(){ - this.options = $.extend({}, webshims.cfg.wspopover, this.options); + this.options = $.extend(true, {}, poCFG, this.options); this.id = webshims.wsPopover.id++; this.eventns = '.wsoverlay' + this.id; this.timers = {}; this.element = $('<div class="ws-popover'+transClass+'" tabindex="-1"><div class="ws-po-outerbox"><div class="ws-po-arrow"><div class="ws-po-arrowbox" /></div><div class="ws-po-box" /></div></div>'); this.contentElement = $('.ws-po-box', this.element); @@ -1235,10 +1247,15 @@ webshims.getContentValidationMessage = function(elem, validity, key){ var message = $(elem).data('errormessage') || elem.getAttribute('x-moz-errormessage') || ''; if(key && message[key]){ message = message[key]; + } else if(message) { + validity = validity || $.prop(elem, 'validity') || {valid: 1}; + if(validity.valid){ + message = ''; + } } if(typeof message == 'object'){ validity = validity || $.prop(elem, 'validity') || {valid: 1}; if(!validity.valid){ $.each(validity, function(name, prop){ @@ -1582,12 +1599,20 @@ webshims.addInputType('email', { mismatch: (function(){ //taken from http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address - var test = cfg.emailReg || /^[a-zA-Z0-9.!#$%&'*+-\/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; + var test = cfg.emailReg || /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; return function(val){ + // optional punycode support: https://github.com/bestiejs/punycode.js + if(window.punycode && punycode.toASCII){ + try { + if( test.test(punycode.toASCII(val)) ){ + return false; + } + } catch(er){} + } return !test.test(val); }; })() }); @@ -3089,14 +3114,11 @@ focusout: unbind, 'input updateInput change': trigger }); } ; - if($.event.customEvent){ - $.event.customEvent.updateInput = true; - } - + $(doc) .on('focusin', function(e){ if( e.target && !e.target.readOnly && !e.target.disabled && (e.target.nodeName || '').toLowerCase() == 'input' && !noInputTypes[e.target.type] && !(webshims.data(e.target, 'implemented') || {}).inputwidgets){ observe($(e.target)); } @@ -3284,10 +3306,14 @@ }); } }); implementProperties.forEach(function(messageProp){ + var skipNames = { + valid: 1, + badInput: 1 + }; webshims.defineNodeNamesProperty(['fieldset', 'output', 'button'], messageProp, { prop: { value: '', writeable: false } @@ -3312,16 +3338,19 @@ if(validity.customError && elem.nodeName){ message = (Modernizr.formvalidation && !webshims.bugs.bustedValidity && desc.prop._supget) ? desc.prop._supget.call(elem) : webshims.data(elem, 'customvalidationMessage'); if(message){return message;} } $.each(validity, function(name, prop){ - if(name == 'valid' || !prop){return;} + if(skipNames[name] || !prop){return;} message = webshims.createValidationMessage(elem, name); if(message){ return false; } }); + if(!message && validity.badInput){ + message = webshims.createValidationMessage(elem, 'typeMismatch') || webshims.createValidationMessage(elem, 'valueMissing'); + } return message || ''; }, writeable: false } }); \ No newline at end of file