vendor/assets/javascripts/webshims/shims/combos/24.js in webshims-rails-1.11.6.1 vs vendor/assets/javascripts/webshims/shims/combos/24.js in webshims-rails-1.12.0
- old
+ new
@@ -790,12 +790,11 @@
});
webshims.defineNodeNamesProperties(['input', 'button'], formSubmitterDescriptors);
}); //webshims.ready end
-
-webshims.register('form-shim-extend2', function($, webshims, window, document, undefined, options){
+;webshims.register('form-shim-extend2', function($, webshims, window, document, undefined, options){
"use strict";
var emptyJ = $([]);
var isNumber = function(string){
return (typeof string == 'number' || (string && string == string * 1));
};
@@ -818,10 +817,12 @@
}
ret = ret.filter('[type="radio"]');
}
return ret;
};
+//support getSetAttribute
+var supportGetSetAttribute = !(('getSetAttribute' in $.support) && !$.support.getSetAttribute);
//submitbubbles for IE6-IE8
var supportSubmitBubbles = !('submitBubbles' in $.support) || $.support.submitBubbles;
var addSubmitBubbles = function(form){
if (!supportSubmitBubbles && form && typeof form == 'object' && !form._submit_attached ) {
@@ -959,11 +960,11 @@
}
}
});
}
-if(('getSetAttribute' in $.support) && !$.support.getSetAttribute && $('<form novalidate></form>').attr('novalidate') == null){
+if(!supportGetSetAttribute && $('<form novalidate></form>').attr('novalidate') == null){
webshims.defineNodeNameProperty('form', 'novalidate', {
attr: {
set: function(val){
this.setAttribute('novalidate', ''+val);
},
@@ -978,24 +979,25 @@
if(!Modernizr.formattribute || !Modernizr.fieldsetdisabled || !Modernizr.fieldsetelements){
(function(){
if(!Modernizr.fieldsetdisabled){
var isFieldsetGroup = /^(?:fieldset)$/i;
+ var disableElementsSel = 'input, textarea, select, button';
$.extend($.expr[":"], {
"enabled": function( elem ) {
- return elem.disabled === false || (isFieldsetGroup.test(elem.nodeName) && elem.getAttribute('disabled') == null && !$(elem).is('fieldset[disabled] *')) ;
+ return elem.disabled === false || (isFieldsetGroup.test(elem.nodeName) && webshims.contentAttr(elem, 'disabled') == null && !$(elem).is('fieldset[disabled] *')) ;
},
"disabled": function( elem ) {
- return elem.disabled === true || (isFieldsetGroup.test(elem.nodeName) && (elem.getAttribute('disabled') != null || $(elem).is('fieldset[disabled] *')));
+ return elem.disabled === true || (isFieldsetGroup.test(elem.nodeName) && (webshims.contentAttr(elem, 'disabled') != null || $(elem).is('fieldset[disabled] *')));
}
});
var groupControl = {
getElements: function(group){
- $('input, textarea, select, button', group).each(groupControl.disable);
+ $(disableElementsSel, group).each(groupControl.disable);
},
disable: function(){
if(!this.disabled){
webshims.data(this, 'groupedisabled', true);
this.disabled = true;
@@ -1008,28 +1010,31 @@
}
}
};
$(window).on('unload', function(){
- $('input, textarea, select, button').each(groupControl.enable);
+ $(disableElementsSel).each(groupControl.enable);
});
webshims.defineNodeNamesBooleanProperty(['fieldset'], 'disabled', {
set: function(value){
if(value){
- $('input, textarea, select, button', this).each(groupControl.disable);
+ $(disableElementsSel, this).each(groupControl.disable);
} else if(!$(this).is('fieldset[disabled] *')){
var nested = $('fieldset[disabled]', this);
- var elements = $('input, textarea, select, button', this);
+ var elements = $(disableElementsSel, this);
+
if(nested.length){
- elements = elements.filter(':not(fieldset[disabled] *');
+ elements = elements.not('fieldset[disabled] *');
}
+
elements.each(groupControl.enable);
}
},
- initAttr: true
+ initAttr: true,
+ useContentAttribute: true
});
['input', 'textarea', 'select', 'button'].forEach(function(nodeName){
var desc = webshims.defineNodeNameProperty(nodeName, 'disabled', {
prop: {
@@ -1057,10 +1062,15 @@
}
});
});
webshims.addReady(function(context){
- $(context).filter('fieldset[disabled], fieldset[disabled] *').each(groupControl.disable);
+
+ $(context)
+ .filter('fieldset[disabled], fieldset[disabled] *')
+ .find(disableElementsSel)
+ .each(groupControl.disable)
+ ;
});
}
if(!Modernizr.formattribute){