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

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

@ -18,18 +18,13 @@ function getNextTabId() {
return ++tabId; return ++tabId;
} }
var isLocal = (function() { var isLocal = function( anchor ) {
var rhash = /#.*$/, var rhash = /#.*$/;
currentPage = location.href.replace( 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
return function( anchor ) { anchor = anchor.cloneNode( false );
// clone the node to work around IE 6 not normalizing the href property return anchor.hash.length > 1 && anchor.href.replace( rhash, "" ) === location.href.replace( rhash, "" );
// 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;
};
})();
$.widget( "ui.tabs", { $.widget( "ui.tabs", {
version: "@VERSION", version: "@VERSION",