Skip to content

Commit

Permalink
Tabs: Deprecate the length method. Fixes #7143 Tabs: Deprecate the le…
Browse files Browse the repository at this point in the history
…ngth method
  • Loading branch information
petersendidit committed Mar 27, 2011
1 parent e378876 commit 03eb54b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
6 changes: 6 additions & 0 deletions tests/unit/tabs/tabs_deprecated.js
Expand Up @@ -139,7 +139,13 @@ test('#5069 - ui.tabs.add creates two tab panels when using a full URL', functio
equals(el.children('div').length, el.find('> ul > li').length, 'After creation, number of panels should be equal to number of tabs');
el.tabs('add', '/ajax_html_echo', 'Test');
equals(el.children('div').length, el.find('> ul > li').length, 'After add, number of panels should be equal to number of tabs');
});

test('length', function() {
expect(1);

el = $('#tabs1').tabs();
equals(el.tabs('length'), $('ul a', el).length, ' should return length');
});

}( jQuery ) );
7 changes: 0 additions & 7 deletions tests/unit/tabs/tabs_methods.js
Expand Up @@ -167,11 +167,4 @@ test('url', function() {
ok(false, "missing test - untested code is broken code.");
});

test('length', function() {
expect(1);

el = $('#tabs1').tabs();
equals(el.tabs('length'), $('ul a', el).length, ' should return length');
});

})(jQuery);
4 changes: 2 additions & 2 deletions tests/unit/tabs/tabs_tickets.js
Expand Up @@ -54,7 +54,7 @@ test('#4033 - IE expands hash to full url and misinterprets tab as ajax', functi

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');

});
Expand All @@ -64,7 +64,7 @@ test('#5893 - Sublist in the tab list are considered as tab', function() {
expect(1);

el = $('#tabs6').tabs();
equals(el.tabs( "length" ), 2, 'should contain 2 tab');
equals(el.data("tabs").anchors.length, 2, 'should contain 2 tab');

});

Expand Down
10 changes: 6 additions & 4 deletions ui/jquery.ui.tabs.js
Expand Up @@ -568,10 +568,6 @@ $.widget( "ui.tabs", {
url: function( index, url ) {
this.anchors.eq( index ).data( "load.tabs", url );
return this;
},

length: function() {
return this.anchors.length;
}
});

Expand Down Expand Up @@ -812,6 +808,12 @@ if ( $.uiBackCompat !== false ) {
};
}( jQuery, jQuery.ui.tabs.prototype ) );

// length method
(function( $, prototype ) {
prototype.length = function() {
return this.anchors.length;
};
}( jQuery, jQuery.ui.tabs.prototype ) );
}

})( jQuery );

0 comments on commit 03eb54b

Please sign in to comment.