diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-11-13 12:29:21 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-11-13 12:29:29 -0500 |
commit | 874865842bdbbf5ec48ee41640951e9f103c0f16 (patch) | |
tree | 2adf39a2983d41b27f963d6dc9f9a6f39508f734 | |
parent | 0a1ab401fa2a491e234f4d700a0e1e14b53db03d (diff) | |
download | jquery-ui-874865842bdbbf5ec48ee41640951e9f103c0f16.tar.gz jquery-ui-874865842bdbbf5ec48ee41640951e9f103c0f16.zip |
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.
-rw-r--r-- | ui/jquery.ui.tabs.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 06bf385e0..25395b8fc 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -36,14 +36,24 @@ $.widget( "ui.tabs", { var rhash = /#.*$/; return function( anchor ) { + var anchorUrl, locationUrl; // support: IE7 // IE7 doesn't normalize the href property when set via script (#9317) anchor = anchor.cloneNode( false ); - return anchor.hash.length > 1 && - decodeURIComponent( anchor.href.replace( rhash, "" ) ) === - decodeURIComponent( location.href.replace( rhash, "" ) ); + anchorUrl = anchor.href.replace( rhash, "" ); + locationUrl = 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; }; })(), |