changeset d3d2d9a2cc92 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=d3d2d9a2cc92
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
diffstat:
src/tab.js | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (24 lines):
diff -r cf315f485159 -r d3d2d9a2cc92 src/tab.js
--- a/src/tab.js Mon Jul 08 18:49:22 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();
@@ -399,7 +397,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',