vendor/assets/javascripts/webshims/shims/combos/3.js in webshims-rails-1.10.10 vs vendor/assets/javascripts/webshims/shims/combos/3.js in webshims-rails-1.10.11

- old
+ new

@@ -1,21 +1,22 @@ //DOM-Extension helper webshims.register('dom-extend', function($, webshims, window, document, undefined){ "use strict"; + var supportHrefNormalized = !('hrefNormalized' in $.support) || $.support.hrefNormalized; + var supportGetSetAttribute = !('getSetAttribute' in $.support) || $.support.getSetAttribute; + webshims.assumeARIA = supportGetSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing; - webshims.assumeARIA = $.support.getSetAttribute || Modernizr.canvas || Modernizr.video || Modernizr.boxsizing; - 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"); } 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){ - 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.extendNative === undefined){ + webshims.warn("extendNative configuration was set to false by default with this 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) { @@ -683,11 +684,11 @@ var ret; if(href == null){return '';} anchor.setAttribute('href', href+'' ); - if(!$.support.hrefNormalized){ + if(!supportHrefNormalized){ try { $(anchor).insertAfter(this); ret = anchor.getAttribute('href', 4); } catch(er){ ret = anchor.getAttribute('href', 4); @@ -1124,10 +1125,14 @@ var toLoad = ['form-validation']; if(options.lazyCustomMessages){ options.customMessages = true; toLoad.push('form-message'); } + if(options.customDatalist){ + options.fD = true; + toLoad.push('form-datalist'); + } if(options.addValidators){ toLoad.push('form-validators'); } webshims.reTest(toLoad); $(document).off('.lazyloadvalidation'); @@ -1262,10 +1267,18 @@ if(prop && name != 'valid' && message[name]){ message = message[name]; return false; } }); + if(typeof message == 'object'){ + if(validity.typeMismatch && message.badInput){ + message = message.badInput; + } + if(validity.badInput && message.typeMismatch){ + message = message.typeMismatch; + } + } } } if(typeof message == 'object'){ message = message.defaultMessage; @@ -1342,23 +1355,25 @@ })(); }); webshims.register('form-message', function($, webshims, window, document, undefined, options){ "use strict"; - if(options.overrideMessages){ + if(options.lazyCustomMessages){ options.customMessages = true; - webshims.error('overrideMessages is deprecated. use customMessages instead.'); } var validityMessages = webshims.validityMessages; var implementProperties = options.customMessages ? ['customValidationMessage'] : []; validityMessages.en = $.extend(true, { typeMismatch: { defaultMessage: 'Please enter a valid value.', email: 'Please enter an email address.', - url: 'Please enter a URL.', + url: 'Please enter a URL.' + }, + badInput: { + defaultMessage: 'Please enter a valid value.', number: 'Please enter a number.', date: 'Please enter a date.', time: 'Please enter a time.', range: 'Invalid input.', month: 'Please enter a valid value.', @@ -1407,18 +1422,21 @@ validityMessages.de = $.extend(true, { typeMismatch: { defaultMessage: '{%value} ist in diesem Feld nicht zulässig.', email: '{%value} ist keine gültige E-Mail-Adresse.', - url: '{%value} ist kein(e) gültige(r) Webadresse/Pfad.', - number: '{%value} ist keine Nummer.', - date: '{%value} ist kein Datum.', - time: '{%value} ist keine Uhrzeit.', - month: '{%value} ist in diesem Feld nicht zulässig.', - range: '{%value} ist keine Nummer.', - "datetime-local": '{%value} ist kein Datum-Uhrzeit Format.' + url: '{%value} ist kein(e) gültige(r) Webadresse/Pfad.' }, + badInput: { + defaultMessage: 'Geben Sie einen zulässigen Wert ein.', + number: 'Geben Sie eine Nummer ein.', + date: 'Geben Sie ein Datum ein.', + time: 'Geben Sie eine Uhrzeit ein.', + month: 'Geben Sie einen Monat mit Jahr ein.', + range: 'Geben Sie eine Nummer.', + "datetime-local": 'Geben Sie ein Datum mit Uhrzeit ein.' + }, rangeUnderflow: { defaultMessage: '{%value} ist zu niedrig. {%min} ist der unterste Wert, den Sie benutzen können.' }, rangeOverflow: { defaultMessage: '{%value} ist zu hoch. {%max} ist der oberste Wert, den Sie benutzen können.' @@ -1461,15 +1479,21 @@ max: 1 }; webshims.createValidationMessage = function(elem, name){ var widget; - var message = getMessageFromObj(currentValidationMessage[name], elem); var type = $.prop(elem, 'type'); + var message = getMessageFromObj(currentValidationMessage[name], elem); + if(!message && name == 'badInput'){ + message = getMessageFromObj(currentValidationMessage.typeMismatch, elem); + } + if(!message && name == 'typeMismatch'){ + message = getMessageFromObj(currentValidationMessage.badInput, elem); + } if(!message){ message = getMessageFromObj(validityMessages[''][name], elem) || $.prop(elem, 'validationMessage'); - webshims.info('could not find errormessage for: '+ name +' / '+ type +'. in language: '+$.webshims.activeLang()); + webshims.info('could not find errormessage for: '+ name +' / '+ type +'. in language: '+webshims.activeLang()); } if(message){ ['value', 'min', 'max', 'title', 'maxlength', '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)) || ''; @@ -1508,24 +1532,18 @@ } }); webshims.activeLang({ register: 'form-core', callback: function(val){ - $.each(validityMessages, function(i, val){ - if(validityMessages[val]){ - currentValidationMessage = validityMessages[val]; - return false; - } - }); + if(validityMessages[val]){ + currentValidationMessage = validityMessages[val]; + } } }); implementProperties.forEach(function(messageProp){ - var skipNames = { - valid: 1, - badInput: 1 - }; + webshims.defineNodeNamesProperty(['fieldset', 'output', 'button'], messageProp, { prop: { value: '', writeable: false } @@ -1550,19 +1568,17 @@ 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(skipNames[name] || !prop){return;} + if(name == 'valid' || !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 } });