mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tabs: Don't decode URLs if they're not UTF-8. Fixes #9518 - Tabs: URLs encoded in anything other than UTF-8 will throw an error.
This commit is contained in:
parent
0a1ab401fa
commit
874865842b
16
ui/jquery.ui.tabs.js
vendored
16
ui/jquery.ui.tabs.js
vendored
@ -36,14 +36,24 @@ $.widget( "ui.tabs", {
|
|||||||
var rhash = /#.*$/;
|
var rhash = /#.*$/;
|
||||||
|
|
||||||
return function( anchor ) {
|
return function( anchor ) {
|
||||||
|
var anchorUrl, locationUrl;
|
||||||
|
|
||||||
// support: IE7
|
// support: IE7
|
||||||
// IE7 doesn't normalize the href property when set via script (#9317)
|
// IE7 doesn't normalize the href property when set via script (#9317)
|
||||||
anchor = anchor.cloneNode( false );
|
anchor = anchor.cloneNode( false );
|
||||||
|
|
||||||
return anchor.hash.length > 1 &&
|
anchorUrl = anchor.href.replace( rhash, "" );
|
||||||
decodeURIComponent( anchor.href.replace( rhash, "" ) ) ===
|
locationUrl = location.href.replace( rhash, "" );
|
||||||
decodeURIComponent( location.href.replace( rhash, "" ) );
|
|
||||||
|
// decoding may throw an error if the URL isn't UTF-8 (#9518)
|
||||||
|
try {
|
||||||
|
anchorUrl = decodeURIComponent( anchorUrl );
|
||||||
|
} catch ( error ) {}
|
||||||
|
try {
|
||||||
|
locationUrl = decodeURIComponent( locationUrl );
|
||||||
|
} catch ( error ) {}
|
||||||
|
|
||||||
|
return anchor.hash.length > 1 && anchorUrl === locationUrl;
|
||||||
};
|
};
|
||||||
})(),
|
})(),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user