vendor/assets/javascripts/webshims/shims/form-shim-extend.js in webshims-rails-1.12.5 vs vendor/assets/javascripts/webshims/shims/form-shim-extend.js in webshims-rails-1.12.7

- old
+ new

@@ -28,12 +28,12 @@ if (bugs.bustedValidity || bugs.findRequired) { (function(){ var find = $.find; var matchesSelector = $.find.matchesSelector; - - var regExp = /(\:valid|\:invalid|\:optional|\:required|\:in-range|\:out-of-range)(?=[\s\[\~\.\+\>\:\#*]|$)/ig; + + var regExp = /(\:valid|\:invalid|\:optional|\:required)(?=[\s\[\~\.\+\>\:\#*]|$)/ig; var regFn = function(sel){ return sel + '-element'; }; $.find = (function(){ @@ -390,18 +390,17 @@ var elem = jElm[0]; var validityState = $.data(elem, 'cachedValidity'); if(validityState){ return validityState; } - validityState = $.extend({}, validityPrototype); + validityState = $.extend({}, validityPrototype); if( !$.prop(elem, 'willValidate') || elem.type == 'submit' ){ return validityState; } - var val = jElm.val(), - cache = {nodeName: elem.nodeName.toLowerCase()} - ; + var val = jElm.val(); + var cache = {nodeName: elem.nodeName.toLowerCase()}; validityState.customError = !!(webshims.data(elem, 'customvalidationMessage')); if( validityState.customError ){ validityState.valid = false; } @@ -424,22 +423,22 @@ inputValidationAPI[name] = { value: function(){ baseCheckValidity.unhandledInvalids = false; return baseCheckValidity($(this).getNativeElement()[0], name); } - } + }; }); webshims.defineNodeNameProperties(nodeName, inputValidationAPI, 'prop'); }); webshims.defineNodeNamesBooleanProperty(['input', 'textarea', 'select'], 'required', { set: function(value){ $(this).getShadowFocusElement().attr('aria-required', !!(value)+''); }, - initAttr: Modernizr.localstorage //only if we have aria-support + initAttr: true }); webshims.defineNodeNamesBooleanProperty(['input'], 'multiple'); if(bugs.bustedValidity){ @@ -602,11 +601,11 @@ .on('invalid', $.noop) ; try { if(context == document && !('form' in (document.activeElement || {}))) { - focusElem = $('input[autofocus], select[autofocus], textarea[autofocus]', context).eq(0).getShadowFocusElement()[0]; + focusElem = $(context.querySelector('input[autofocus], select[autofocus], textarea[autofocus]')).eq(0).getShadowFocusElement()[0]; if (focusElem && focusElem.offsetHeight && focusElem.offsetWidth) { focusElem.focus(); } } } @@ -623,10 +622,10 @@ var select = $('select', elem); var options; if(select[0]){ options = $.makeArray(select[0].options || []); } else { - options = $('option', elem).get(); + options = elem.getElementsByTagName('option'); if(options.length){ webshims.warn('you should wrap your option-elements for a datalist in a select element to support IE and other old browsers.'); } } return options;