]> source.dussan.org Git - jquery-ui.git/commitdiff
Tabs: Fixed IE bug which would mistake tabs as ajax with dynamically created HTML...
authorKlaus Hartl <klaus.hartl@googlemail.com>
Sun, 1 Feb 2009 21:09:02 +0000 (21:09 +0000)
committerKlaus Hartl <klaus.hartl@googlemail.com>
Sun, 1 Feb 2009 21:09:02 +0000 (21:09 +0000)
tests/unit/tabs/tabs.js
ui/ui.tabs.js

index 1c470bf7bf70e41b99f81f889ab060318ae3df61..1ffa08bbf9f472a8cd4edf5190e1d29bcc78a8ad 100644 (file)
@@ -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);
index e02e61c30d3e8e181acb153222fbf1a4651960e8..224c2d9bcf690117cf7d90216d37795edc9c1cd2 100644 (file)
@@ -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))