});
});
+
+test('#6710 - selectors are global', function() {
+ // http://bugs.jqueryui.com/ticket/6710
+ expect(1);
+
+ var container = $('\
+ <div>\
+ <div id="tabs_6710">\
+ <ul>\
+ <li><a href="#tabs-1_6710">Nunc tincidunt</a></li>\
+ <li><a href="#tabs-2_6710">Proin dolor</a></li>\
+ </ul>\
+ <div id="tabs-1_6710"> <p>first</p> </div>\
+ <div id="tabs-2_6710"> <p>second</p>\
+ </div>\
+ </div>');
+ container.find('#tabs_6710').tabs();
+ ok( container.find('#tabs-2_6710').hasClass('ui-tabs-hide'), 'should find panels and add corresponding classes' );
+});
+
+
})(jQuery);
// inline tab
if ( fragmentId.test( href ) ) {
- self.panels = self.panels.add( self._sanitizeSelector( href ) );
+ self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
// remote tab
// prevent loading the page itself if href is just "#"
} else if ( href && href !== "#" ) {
var id = self._tabId( a );
a.href = "#" + id;
- var $panel = $( "#" + id );
+ var $panel = self.element.find( "#" + id );
if ( !$panel.length ) {
$panel = $( o.panelTemplate )
.attr( "id", id )
this.lis.removeClass( "ui-tabs-selected ui-state-active" );
// check for length avoids error when initializing empty list
if ( o.selected >= 0 && this.anchors.length ) {
- $( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
+ self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
// seems to be expected behavior that the show callback is fired
self.element.queue( "tabs", function() {
self._trigger( "show", null,
- self._ui( self.anchors[ o.selected ], $( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ) ) );
+ self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ) ) );
});
this.load( o.selected );
var el = this,
$li = $(el).closest( "li" ),
$hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
- $show = $( self._sanitizeSelector( el.hash ) );
+ $show = self.element.find( self._sanitizeSelector( el.hash ) );
// If tab is already selected and not collapsible or tab disabled or
// or is already loading or click callback returns false stop here.
$li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
// try to find an existing element before creating a new one
- var $panel = $( "#" + id );
+ var $panel = self.element.find( "#" + id );
if ( !$panel.length ) {
$panel = $( o.panelTemplate )
.attr( "id", id )
this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
url: url,
success: function( r, s ) {
- $( self._sanitizeSelector( a.hash ) ).html( r );
+ self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
// take care of tab labels
self._cleanup();