@@ -94,11 +94,11 @@ define([
94
94
isLocal = function ( anchor ) {
95
95
return anchor . hash . length > 1 &&
96
96
anchor . href . replace ( rhash , '' ) ===
97
- location . href . replace ( rhash , '' )
98
- // support: Safari 5.1
99
- // Safari 5.1 doesn't encode spaces in window.location
100
- // but it does encode spaces from anchors (#8777)
101
- . replace ( / \s / g, '%20' ) ;
97
+ location . href . replace ( rhash , '' )
98
+ // support: Safari 5.1
99
+ // Safari 5.1 doesn't encode spaces in window.location
100
+ // but it does encode spaces from anchors (#8777)
101
+ . replace ( / \s / g, '%20' ) ;
102
102
} ;
103
103
104
104
// Extension for mage.tabs - Move panels in destination element
@@ -126,12 +126,16 @@ define([
126
126
127
127
if ( ! panel . length ) {
128
128
id = $ ( tab ) . attr ( 'aria-controls' ) ;
129
- panel = $ ( this . options . destination ) . find ( '#' + CSS . escape ( id ) ) ;
129
+ panel = $ ( this . options . destination ) . find ( this . _sanitizeSelector ( '#' + id ) ) ;
130
130
}
131
131
132
132
return panel ;
133
133
} ,
134
134
135
+ _sanitizeSelector : function ( hash ) {
136
+ return hash ? hash . replace ( / [ ! " $ % & ' ( ) * + , . \/ : ; < = > ? @ \[ \] \^ ` { | } ~ ] / g, "\\$&" ) : "" ;
137
+ } ,
138
+
135
139
/**
136
140
* @private
137
141
*/
@@ -168,9 +172,8 @@ define([
168
172
169
173
// inline tab
170
174
if ( isLocal ( anchor ) ) {
171
- selector = decodeURIComponent ( anchor . hash ) ;
172
- panelId = selector . substring ( 1 ) ;
173
- panel = that . element . find ( '#' + CSS . escape ( panelId ) ) ;
175
+ selector = anchor . hash ;
176
+ panel = that . document . find ( that . _sanitizeSelector ( selector ) ) ;
174
177
// remote tab
175
178
} else {
176
179
panelId = tab . attr ( 'aria-controls' ) || $ ( { } ) . uniqueId ( ) [ 0 ] . id ;
0 commit comments