Skip to content

Commit

Permalink
Fixed #138
Browse files Browse the repository at this point in the history
  • Loading branch information
niceue committed Jul 7, 2014
1 parent 7b72f46 commit 2f3e918
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/jquery.validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@

if (!isObject(obj)) return;

for (var k in obj) {
for (var k in obj) if (checkRuleName(k)) {
that[k] = getRule(obj[k]);
}
}
Expand Down Expand Up @@ -1332,6 +1332,10 @@
return Date.parse(str.replace(/\.|\-/g, '/'));
}

function checkRuleName(name) {
return /^[\w\d]+$/.test(name);
}


// Global events
$(document)
Expand Down Expand Up @@ -1397,11 +1401,13 @@

if (params) {
if (params.length === 1) {
if (!val && !me.test(element, params[0]) ) {
attr(element, ARIA_REQUIRED, null);
return null;
} else {
attr(element, ARIA_REQUIRED, true);
if (checkRuleName(params[0])) {
if (!val && !me.test(element, params[0]) ) {
attr(element, ARIA_REQUIRED, null);
return null;
} else {
attr(element, ARIA_REQUIRED, true);
}
}
}
else if (params[0] === 'not') {
Expand Down

0 comments on commit 2f3e918

Please sign in to comment.