Created
January 9, 2013 19:15
-
-
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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