aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorKlaus Hartl <klaus.hartl@googlemail.com>2009-01-19 23:11:30 +0000
committerKlaus Hartl <klaus.hartl@googlemail.com>2009-01-19 23:11:30 +0000
commit59c6f97625cf6f149af7543b1739aa8d22737e6e (patch)
tree58d3c66d26d2fc42b5a8513da1249fe90bbf06e3 /ui
parent8f4ae539f3d09cd6e4f6348dcb9b8b5846d69c12 (diff)
downloadjquery-ui-59c6f97625cf6f149af7543b1739aa8d22737e6e.tar.gz
jquery-ui-59c6f97625cf6f149af7543b1739aa8d22737e6e.zip
UI Tabs: url containing a fragment identfier broke Ajax tab loading, fixes #3627
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.tabs.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js
index 54609c3fd..0bcd68fb8 100644
--- a/ui/ui.tabs.js
+++ b/ui/ui.tabs.js
@@ -93,17 +93,21 @@ $.widget("ui.tabs", {
this.$lis = $('li:has(a[href])', this.list);
this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
this.$panels = $([]);
-
+
var self = this, o = this.options;
+ var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
this.$tabs.each(function(i, a) {
+ var href = $(a).attr('href');
+
// inline tab
- if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash
- self.$panels = self.$panels.add(self._sanitizeSelector(a.hash));
+ if (fragmentId.test(href))
+ self.$panels = self.$panels.add(self._sanitizeSelector(href));
+
// remote tab
- else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
- $.data(a, 'href.tabs', a.href); // required for restore on destroy
- $.data(a, 'load.tabs', a.href); // mutable
+ else if (href != '#') { // prevent loading the page itself if href is just "#"
+ $.data(a, 'href.tabs', href); // required for restore on destroy
+ $.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data, NOTE IE fails to load if url contains fragment identifier - TODO jQuery Ajax bug?
var id = self._tabId(a);
a.href = '#' + id;
var $panel = $('#' + id);
@@ -114,6 +118,7 @@ $.widget("ui.tabs", {
}
self.$panels = self.$panels.add($panel);
}
+
// invalid tab href
else
o.disabled.push(i + 1);