r1948 - in trunk: tests/unit/tabs ui

r1948 - in trunk: tests/unit/tabs ui


Author: klaus.hartl
Date: Sun Feb 1 13:09:02 2009
New Revision: 1948
Modified:
trunk/tests/unit/tabs/tabs.js
trunk/ui/ui.tabs.js
Log:
Tabs: Fixed IE bug which would mistake tabs as ajax with dynamically
created HTML, fixes #4033
Modified: trunk/tests/unit/tabs/tabs.js
==============================================================================
--- trunk/tests/unit/tabs/tabs.js    (original)
+++ trunk/tests/unit/tabs/tabs.js    Sun Feb 1 13:09:02 2009
@@ -262,6 +262,17 @@
        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);
Modified: trunk/ui/ui.tabs.js
==============================================================================
--- trunk/ui/ui.tabs.js    (original)
+++ trunk/ui/ui.tabs.js    Sun Feb 1 13:09:02 2009
@@ -62,6 +62,10 @@
        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))