Search and Top Navigation
#5956 closed bug (notabug)
Opened August 16, 2010 02:39PM UTC
Closed August 16, 2010 02:54PM UTC
Last modified October 11, 2012 09:15PM UTC
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);
}
}
));
}
Please close; unable to reproduce outside of context.