changeset 6a77d9f066a6 in sao:4.8
details: https://hg.tryton.org/sao?cmd=changeset;node=6a77d9f066a6
description:
        Do not use DOM order to find current tab

        The DOM and the tabs list are not ensured to have the same order 
because the
        DOM is modified after the view promise is resolved.
        To rely only on a single information source, we store the tab as data 
on the
        nav li.

        issue8443
        review249521004
        (grafted from d3d2d9a2cc92cf66097bc3f2b9894e247c01ab14)
diffstat:

 src/tab.js |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (24 lines):

diff -r d6f05bc2a8c0 -r 6a77d9f066a6 src/tab.js
--- a/src/tab.js        Wed Jul 17 22:50:25 2019 +0200
+++ b/src/tab.js        Mon Jul 08 18:51:36 2019 +0200
@@ -339,9 +339,7 @@
         return jQuery.when();
     };
     Sao.Tab.tabs.get_current = function() {
-        var tabs = jQuery('#tablist');
-        var i = tabs.find('li').index(tabs.find('li.active'));
-        return Sao.Tab.tabs[i];
+        return jQuery('#tablist').find('li.active').data('tab');
     };
     Sao.Tab.tabs.close_current = function() {
         var tab = this.get_current();
@@ -386,7 +384,8 @@
             'data-placement': 'bottom',
             id: 'nav-' + tab.id
         }).append(tab_link)
-        .appendTo(tablist);
+        .appendTo(tablist)
+        .data('tab', tab);
         jQuery('<div/>', {
             role: 'tabpanel',
             'class': 'tab-pane',

Reply via email to