summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/toolbar/js/toolbar.menu.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/toolbar/js/toolbar.menu.js')
-rw-r--r--core/modules/toolbar/js/toolbar.menu.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/modules/toolbar/js/toolbar.menu.js b/core/modules/toolbar/js/toolbar.menu.js
index ca9031baf356..1b8d4b5045ef 100644
--- a/core/modules/toolbar/js/toolbar.menu.js
+++ b/core/modules/toolbar/js/toolbar.menu.js
@@ -19,7 +19,9 @@
switcher = typeof switcher !== 'undefined' ? switcher : !$item.hasClass('open');
$item.toggleClass('open', switcher);
$toggle.toggleClass('open', switcher);
- $toggle.find('.action').text(switcher ? ui.handleClose : ui.handleOpen);
+ $toggle.find('.action').each((index, element) => {
+ element.textContent = switcher ? ui.handleClose : ui.handleOpen;
+ });
}
function toggleClickHandler(event) {
@@ -50,8 +52,9 @@
if ($item.children('ul.toolbar-menu').length) {
const $box = $item.children('.toolbar-box');
+ const $link = $box.find('a');
options.text = Drupal.t('@label', {
- '@label': $box.find('a').text()
+ '@label': $link.length ? $link[0].textContent : ''
});
$item.children('.toolbar-box').append(Drupal.theme('toolbarMenuItemToggle', options));
}