diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-10-22 15:51:08 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-10-22 15:51:51 +0200 |
commit | 2b7ca79118fbfc7b8ada627a11ee63e6ec95bccb (patch) | |
tree | cfa117b4ded38915a72daeacd8472c0947bd9dcf /modules/luci-base/htdocs/luci-static/resources | |
parent | 982ba6cf2f3205a74dc07f9dae975614fe0f7550 (diff) |
luci-base: ui.js: prevent race condition in tab initialization
Fixes: #3150
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index caae812812..c1389a8fdf 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -2021,6 +2021,9 @@ return L.Class.extend({ document.querySelectorAll('[data-tab]').forEach(function(tab) { var parent = tab.parentNode; + if (L.dom.matches(tab, 'li') && L.dom.matches(parent, 'ul.cbi-tabmenu')) + return; + if (!parent.hasAttribute('data-tab-group')) parent.setAttribute('data-tab-group', groups.length); @@ -2053,6 +2056,9 @@ return L.Class.extend({ groupId = +group.getAttribute('data-tab-group'), selected = null; + if (group.getAttribute('data-initialized') === 'true') + return; + for (var i = 0, pane; pane = panes[i]; i++) { var name = pane.getAttribute('data-tab'), title = pane.getAttribute('data-tab-title'), @@ -2072,6 +2078,7 @@ return L.Class.extend({ } group.parentNode.insertBefore(menu, group); + group.setAttribute('data-initialized', true); if (selected === null) { selected = this.getActiveTabId(panes[0]); |