From a43965fd77ca72f480b1fd9651273da56552b385 Mon Sep 17 00:00:00 2001 From: cvillasenor Date: Wed, 10 Jul 2024 17:50:53 -0600 Subject: [PATCH] fix(menu-item): replace innerHTML of menu item to fix string bug on player --- src/js/menu/menu-item.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/js/menu/menu-item.js b/src/js/menu/menu-item.js index 99accf6d4..90daf923f 100644 --- a/src/js/menu/menu-item.js +++ b/src/js/menu/menu-item.js @@ -74,6 +74,15 @@ class MenuItem extends ClickableComponent { textContent: this.localize(this.options_.label) }); + const containsHexCode = (s) => { + return /\w*(&#x...)\w*/.test(s); + }; + + if (containsHexCode(menuItemEl.textContent)) { + // Replacement that allows innerHTML to be render properly. + menuItemEl.innerHTML = menuItemEl.textContent; + } + // If using SVG icons, the element with vjs-icon-placeholder will be added separately. if (this.player_.options_.experimentalSvgIcons) { el.appendChild(menuItemEl);