Bug fix for isLocal function in jQuery Tabs.

isLocal function was not compatible with HTML5 push state as the url
could have changed since the page was loaded as in cases with
Backbone.js
This commit is contained in:
Alex Rhea 2012-01-03 13:00:02 -05:00
parent ce7918fc73
commit eef633e32a

11
ui/jquery.ui.tabs.js vendored
View File

@ -18,18 +18,13 @@ function getNextTabId() {
return ++tabId;
}
var isLocal = (function() {
var rhash = /#.*$/,
currentPage = location.href.replace( rhash, "" );
return function( anchor ) {
var isLocal = function( anchor ) {
var rhash = /#.*$/;
// clone the node to work around IE 6 not normalizing the href property
// if it's manually set, i.e., a.href = "#foo" kills the normalization
anchor = anchor.cloneNode( false );
return anchor.hash.length > 1 &&
anchor.href.replace( rhash, "" ) === currentPage;
return anchor.hash.length > 1 && anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
};
})();
$.widget( "ui.tabs", {
version: "@VERSION",