1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-21 01:39:04 +02:00

fix(menu-item): replace innerHTML of menu item to fix string bug on player

This commit is contained in:
cvillasenor 2024-07-10 17:50:53 -06:00
parent 51b4670f69
commit a43965fd77

View File

@ -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);