@@ -99,9 +99,7 @@ return $.widget( "ui.calendar", {
99
99
// TODO: Handle for pickers with multiple months
100
100
switch ( event . keyCode ) {
101
101
case $ . ui . keyCode . ENTER :
102
- this . element . find (
103
- "#" + this . grid . attr ( "aria-activedescendant" ) + " > a:first"
104
- ) . mousedown ( ) ;
102
+ this . activeDescendant . mousedown ( ) ;
105
103
return ;
106
104
case $ . ui . keyCode . PAGE_UP :
107
105
this . date . adjust ( event . altKey ? "Y" : "M" , - 1 ) ;
@@ -147,7 +145,10 @@ return $.widget( "ui.calendar", {
147
145
. attr ( "aria-activedescendant" , id )
148
146
. find ( ".ui-state-focus" )
149
147
. removeClass ( "ui-state-focus" ) ;
150
- this . grid . find ( "#" + id ) . find ( "a" ) . addClass ( "ui-state-focus" ) ;
148
+
149
+ this . activeDescendant = this . grid . find (
150
+ this . _sanitizeSelector ( "#" + id ) + " > a"
151
+ ) . addClass ( "ui-state-focus" ) ;
151
152
} ,
152
153
153
154
_createCalendar : function ( ) {
@@ -470,6 +471,10 @@ return $.widget( "ui.calendar", {
470
471
return $ ( "<a>" ) . text ( this . labels [ key ] ) . html ( ) ;
471
472
} ,
472
473
474
+ _sanitizeSelector : function ( hash ) {
475
+ return hash ? hash . replace ( / [ ! " $ % & ' ( ) * + , . \/ : ; < = > ? @ \[ \] \^ ` { | } ~ ] / g, "\\$&" ) : "" ;
476
+ } ,
477
+
473
478
_setHiddenPicker : function ( ) {
474
479
this . element . attr ( {
475
480
"aria-hidden" : "true" ,
0 commit comments