You can throw away innerHTML and replace it with the new setHTML(), which has a built-in sanitizer. Here's how it works:
Discussion
You can throw away innerHTML and replace it with the new setHTML(), which has a built-in sanitizer. Here's how it works:
@firefoxwebdevs Looks great but why is it called setHTML? What is the ‘set’ supposed to mean?
@LeonardoDiOttio I see what you're getting at, but replaceChildrenWithParsedHTML is a bit long.
Fwiw when you set innerHTML you're not really setting the HTML either.
@firefoxwebdevs Fantastic! Can’t wait for this to be in baseline!
Here are the full docs https://developer.mozilla.org/en-US/docs/Web/API/HTML_Sanitizer_API
@firefoxwebdevs awesome! Now we only have to wait for "baseline" 😉
@xela hopefully it won't be too long! Just Safari to go