Skip to content
Permalink
Browse files

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
  • Loading branch information...
arhea committed Jan 3, 2012
1 parent ce7918f commit eef633e32a20ad93355060a8eef4b2129cf0bc5c
Showing with 7 additions and 12 deletions.
  1. +7 −12 ui/jquery.ui.tabs.js
@@ -18,18 +18,13 @@ function getNextTabId() {
return ++tabId;
}

var isLocal = (function() {
var rhash = /#.*$/,
currentPage = location.href.replace( rhash, "" );

return function( anchor ) {
// 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;
};
})();
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, "" ) === location.href.replace( rhash, "" );
};

$.widget( "ui.tabs", {
version: "@VERSION",

0 comments on commit eef633e

Please sign in to comment.
You can’t perform that action at this time.