diff options
author | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-02-01 21:09:02 +0000 |
---|---|---|
committer | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-02-01 21:09:02 +0000 |
commit | c8360e619b03235e5b7fc5272f0a6722707d2312 (patch) | |
tree | cc885c2a294fe2c5cacfb1d9a873e386aaff7f9f | |
parent | 1866e1382f7ef89721432cb75e505356f067f99d (diff) | |
download | jquery-ui-c8360e619b03235e5b7fc5272f0a6722707d2312.tar.gz jquery-ui-c8360e619b03235e5b7fc5272f0a6722707d2312.zip |
Tabs: Fixed IE bug which would mistake tabs as ajax with dynamically created HTML, fixes #4033
-rw-r--r-- | tests/unit/tabs/tabs.js | 11 | ||||
-rw-r--r-- | ui/ui.tabs.js | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/unit/tabs/tabs.js b/tests/unit/tabs/tabs.js index 1c470bf7b..1ffa08bbf 100644 --- a/tests/unit/tabs/tabs.js +++ b/tests/unit/tabs/tabs.js @@ -262,6 +262,17 @@ module('tabs: Tickets'); equals( $('a:eq(2)', el).data('load.tabs'), 'test.html', 'should ignore fragment identifier' ); }); + + test('IE expands hash to full url and misinterprets tab as ajax, #4033', function() { // http://ui.jquery.com/bugs/ticket/4033 + expect(1); + + el = $('<div><ul><li><a href="#tab">Tab</a></li></ul><div id="tab"></div></div>') + .appendTo('#main').tabs(); + + equals($('a', el).data('load.tabs'), undefined, 'should not create ajax tab'); + + }); + // test('', function() { // expect(0); diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js index e02e61c30..224c2d9bc 100644 --- a/ui/ui.tabs.js +++ b/ui/ui.tabs.js @@ -62,6 +62,10 @@ $.widget("ui.tabs", { var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash 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; // inline tab if (fragmentId.test(href)) |