Permalink
Browse files

Core: Improve id escaping, store escaped id in describedby

Ref #1275
Fixes #1269
Closes #1273
  • Loading branch information...
jzaefferer committed Sep 23, 2014
1 parent 452b823 commit d36d1bcb45fdb6488aea81356e4e1e132e818ee3
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core.js
View
@@ -770,7 +770,7 @@ $.extend( $.validator, {
// If the element is not a child of an associated label, then it's necessary
// to explicitly apply aria-describedby
- errorID = error.attr( "id" );
+ errorID = error.attr( "id" ).replace( /(:|\.|\[|\])/g, "\\$1");
// Respect existing non-error aria-describedby
if ( !describedBy ) {
describedBy = errorID;
@@ -810,7 +810,7 @@ $.extend( $.validator, {
// aria-describedby should directly reference the error element
if ( describer ) {
- selector = selector + ", #" + describer.replace( /[\[\]]/g, "\\$&" ).replace( /\s+/g, ", #" );
+ selector = selector + ", #" + describer.replace( /\s+/g, ", #" );
}
return this
.errors()

0 comments on commit d36d1bc

Please sign in to comment.