Skip to content

Commit

Permalink
fix(menu-item): replace innerHTML of menu item to fix string bug on p…
Browse files Browse the repository at this point in the history
…layer
  • Loading branch information
CarlosVillasenor committed Jul 10, 2024
1 parent dc74abe commit e809ff0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/js/menu/menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e809ff0

Please sign in to comment.