vendor/assets/javascripts/webshims/shims/combos/31.js in webshims-rails-1.10.10 vs vendor/assets/javascripts/webshims/shims/combos/31.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; @@ -1437,37 +1450,9 @@ } } } } }; - - if(formsCFG.customDatalist && (!listSupport || !('selectedOption' in $('<input />')[0]))){ - //currently not supported x-browser (FF4 has not implemented and is not polyfilled ) - inputListProto.selectedOption = { - prop: { - writeable: false, - get: function(){ - var elem = this; - var list = $.prop(elem, 'list'); - var ret = null; - var value, options; - if(!list){return ret;} - value = $.prop(elem, 'value'); - if(!value){return ret;} - options = $.prop(list, 'options'); - if(!options.length){return ret;} - $.each(options, function(i, option){ - if(value == $.prop(option, 'value')){ - ret = option; - return false; - } - }); - return ret; - } - } - }; - } - if(listSupport){ //options only return options, if option-elements are rooted: but this makes this part of HTML5 less backwards compatible if(!($('<datalist><select><option></option></select></datalist>').prop('options') || []).length ){ webshims.defineNodeNameProperty('datalist', 'options', { \ No newline at end of file