Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#5956 closed bug (notabug)

Restoring tabs from cloned object causes tabs to stop hiding when new tab is clicked

Reported by: precisonline Owned by:
Priority: major Milestone:
Component: ui.tabs Version: 1.8.4
Keywords: tabs clone Cc:
Blocked by: Blocking:

Description

I have a jquery extension that is used with ajax to make a clone of a div on the screen and save it as data on the parent, then later restore that clone once the ajax request is done and dismissed by the user. (Sort of an "ajax back button" if you will.) I'm using clone(true) to clone the handlers when stacking the replaceable division, and normally this works fine. However, this does not seem to work quite right with tabs.

Here's the scenario, I display a page that has tabs. One of the tabs has a link on it. When that link is clicked a script is invoked which takes the division holding the tabs and pushes it (with the clone(true) thing) onto a stack. It then replaces that section with the results of an ajax call. The user can then click on a "done" button to dismiss the screen loaded via ajax and return to the original list. When they do this, the tabs display properly until a tab is clicked, at which point the previous tab is not hidden as it would be normally.

I've tested in FF 3.6.6, IE8, and Chrome and the same behavior happens in all of them. Here's a video that demonstrates the issue: http://screencast.com/t/ZGNjZGY2O

Here's the code that does the pushing and popping of the division:

$.fn.pushDiv = function() {

return(this.each(

function () {

var list = $(this).parent().data('stack'); if(!list) {

list = new Array();

} list.push($(this).clone(true)); $(this).parent().data('stack',list);

}

));

}

$.fn.popDiv = function() {

return(this.each(

function () {

var list = $(this).parent().data('stack'); if(list) {

if(list.length > 0) {

do {

var obj = list.pop();

} while (list.length > 0 && $(obj).find('.nopop').length > 0); $(this).replaceWith(obj);

}

$(this).parent().data('stack',list);

}

}

));

}

Change History (3)

comment:1 Changed 9 years ago by precisonline

Please close; unable to reproduce outside of context.

comment:2 Changed 9 years ago by Scott González

Resolution: invalid
Status: newclosed

comment:3 Changed 7 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.