aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.tabs.js
diff options
context:
space:
mode:
authorKlaus Hartl <klaus.hartl@googlemail.com>2009-02-19 20:19:13 +0000
committerKlaus Hartl <klaus.hartl@googlemail.com>2009-02-19 20:19:13 +0000
commit1ca5ae160ca1243ba6232abba8f52e09dd7172f6 (patch)
tree89093ddcc2f707875362bdedf12e99b4bebe3b9e /ui/ui.tabs.js
parente5268f9c32d9f934e942aacbce8acfaf73d8c477 (diff)
downloadjquery-ui-1ca5ae160ca1243ba6232abba8f52e09dd7172f6.tar.gz
jquery-ui-1ca5ae160ca1243ba6232abba8f52e09dd7172f6.zip
Tabs: normalization of href attribute required in IE, fixes #4134
Diffstat (limited to 'ui/ui.tabs.js')
-rw-r--r--ui/ui.tabs.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js
index 57ff72f94..f9d4cc512 100644
--- a/ui/ui.tabs.js
+++ b/ui/ui.tabs.js
@@ -81,13 +81,20 @@ $.widget("ui.tabs", {
this.$tabs.each(function(i, a) {
var href = $(a).attr('href');
- // For dynamically created HTML that contains a hash as href IE expands
- // such href to the full page url with hash and then misinterprets tab as ajax...
- if (href.split('#')[0] == location.toString().split('#')[0]) href = a.hash;
-
+ // For dynamically created HTML that contains a hash as href IE < 8 expands
+ // such href to the full page url with hash and then misinterprets tab as ajax.
+ // Same consideration applies for an added tab with a fragment identifier
+ // since a[href=#fragment-identifier] does unexpectedly not match.
+ // Thus normalize href attribute...
+ if (href.split('#')[0] == location.toString().split('#')[0]) {
+ href = a.hash;
+ a.href = href;
+ }
+
// inline tab
- if (fragmentId.test(href))
+ if (fragmentId.test(href)) {
self.$panels = self.$panels.add(self._sanitizeSelector(href));
+ }
// remote tab
else if (href != '#') { // prevent loading the page itself if href is just "#"
@@ -109,8 +116,9 @@ $.widget("ui.tabs", {
}
// invalid tab href
- else
+ else {
o.disabled.push(i);
+ }
});
// initialization from scratch