You can throw away innerHTML and replace it with the new setHTML(), which has a built-in sanitizer. Here's how it works:
HTML Sanitizer API - Web APIs | MDN

The HTML Sanitizer API allows developers to take strings of HTML and filter out unwanted elements, attributes, and other HTML entities when they are inserted into the DOM or a shadow DOM.

MDN Web Docs
@firefoxwebdevs awesome! Now we only have to wait for "baseline" 😉
@xela hopefully it won't be too long! Just Safari to go