vendor/assets/javascripts/webshims/shims/combos/31.js in webshims-rails-1.12.7 vs vendor/assets/javascripts/webshims/shims/combos/31.js in webshims-rails-1.13.0
- old
+ new
@@ -1397,10 +1397,11 @@
}
};
webshims.getContentValidationMessage = function(elem, validity, key){
+ var customRule;
if(webshims.errorbox && webshims.errorbox.initIvalContentMessage){
webshims.errorbox.initIvalContentMessage(elem);
}
var message = (webshims.getOptions && webshims.errorbox ? webshims.getOptions(elem, 'errormessage', false, true) : $(elem).data('errormessage')) || elem.getAttribute('x-moz-errormessage') || '';
if(key && message[key]){
@@ -1411,10 +1412,12 @@
message = '';
}
}
if(typeof message == 'object'){
validity = validity || $.prop(elem, 'validity') || {valid: 1};
- if(!validity.valid){
+ if(validity.customError && (customRule = $.data(elem, 'customMismatchedRule')) && message[customRule] && typeof message[customRule] == 'string'){
+ message = message[customRule];
+ } else if(!validity.valid){
$.each(validity, function(name, prop){
if(prop && name != 'valid' && message[name]){
message = message[name];
return false;
}