Skip to content

Commit

Permalink
Core: Switch dataRules parsing to W3C HTML5 spec style
Browse files Browse the repository at this point in the history
Closes gh-778
  • Loading branch information
johnnyreilly authored and jzaefferer committed Jan 14, 2014
1 parent 2afa4b7 commit 460fd22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ $.extend($.validator, {
// return the custom message for the given element and validation method
// specified in the element's HTML5 data attribute
customDataMessage: function( element, method ) {
return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
return $(element).data("msg" + method[0].toUpperCase() + method.substring(1).toLowerCase());

},

// return the custom message for the given element name and validation method
Expand Down Expand Up @@ -911,7 +912,7 @@ $.extend($.validator, {
var method, value,
rules = {}, $element = $(element);
for (method in $.validator.methods) {
value = $element.data("rule-" + method.toLowerCase());
value = $element.data("rule" + method[0].toUpperCase() + method.substring(1).toLowerCase());
if ( value !== undefined ) {
rules[method] = value;
}
Expand Down

0 comments on commit 460fd22

Please sign in to comment.