Skip to content

Instantly share code, notes, and snippets.

@dylanjha
Created January 9, 2013 19:15
Show Gist options
  • Save dylanjha/4495968 to your computer and use it in GitHub Desktop.
Save dylanjha/4495968 to your computer and use it in GitHub Desktop.
Patch for bug with jquery-ui-tabs api when <head> has a <base href> tag. http://bugs.jqueryui.com/ticket/4941 http://bugs.jqueryui.com/ticket/8637
//this is to patch a bug with the jquery.ui.tabs API
// http://bugs.jqueryui.com/ticket/4941
// http://bugs.jqueryui.com/ticket/8637
// it has to do with the <base href> tag in <head> and jquery.ui.tabs
// being smart about figuring out weather to AJAX a tab or not
;(function() {
var tabsInitialised = false;
var _tabs = $.fn.tabs;
var updateBaseHrefs = function() {
var base = location.href.replace(/#.*$/, '');
$('[data-jquery-ui-local]=true').each(function () {
var href = $(this).attr('href');
$(this).attr('href', base + href);
});
tabsInitialised = true;
};
$.fn.tabs = function() {
if (!tabsInitialised) updateBaseHrefs();
return _tabs.apply(this, arguments);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment