Skip to content

Commit 460fd22

Browse files
johnnyreillyjzaefferer
authored andcommitted
Core: Switch dataRules parsing to W3C HTML5 spec style
Closes gh-778
1 parent 2afa4b7 commit 460fd22

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ $.extend($.validator, {
609609
// return the custom message for the given element and validation method
610610
// specified in the element's HTML5 data attribute
611611
customDataMessage: function( element, method ) {
612-
return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
612+
return $(element).data("msg" + method[0].toUpperCase() + method.substring(1).toLowerCase());
613+
613614
},
614615

615616
// return the custom message for the given element name and validation method
@@ -911,7 +912,7 @@ $.extend($.validator, {
911912
var method, value,
912913
rules = {}, $element = $(element);
913914
for (method in $.validator.methods) {
914-
value = $element.data("rule-" + method.toLowerCase());
915+
value = $element.data("rule" + method[0].toUpperCase() + method.substring(1).toLowerCase());
915916
if ( value !== undefined ) {
916917
rules[method] = value;
917918
}

0 commit comments

Comments
 (0)