changeset b52610f7f962 in sao:4.6
details: https://hg.tryton.org/sao?cmd=changeset;node=b52610f7f962
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 b69450b90e01 -r b52610f7f962 src/tab.js
--- a/src/tab.js Mon Jul 08 21:26:20 2019 +0200
+++ b/src/tab.js Mon Jul 08 18:51:36 2019 +0200
@@ -329,9 +329,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();
@@ -377,7 +375,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',