Issue with tab deletion

Issue with tab deletion


I just recently started using jQuery so I wanted to ask about this
before reporting it as a bug. It appears that occasionally when a tab
is deleted using $("#example").tabs("remove", index) the selected.tabs
property in data is set to -1. This makes any operations done after
the deletion that require the selected tab's index not work when using
the recommended way of getting the currently selected tab index: $
("#tab_element").data("selected.tabs");. I tried setting the
selected.tabs value in the "show" callback function, but that didn't
seem to change anything. Here is the function I am using to delete
tabs:
function deleteTab(){
        var tabEl = $j(".ui-tabs-selected");
        var tabsEl = $j("#tabs");
        if(confirm('Are you sure you want to delete the "' + tabEl.find
("span").html() + '" tab?')){
            tabsEl.tabs("remove", tabsEl.data("selected.tabs"));
        }
    }
Thank you for any help!