News for hackers. Stuff that matters.
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by DoctorOW on Tuesday February 24, 2026 @08:59AM (#47137253)
They do link the default configuration for "safe": https://wicg.github.io/sanitizer-api/#built-in-safe-default-...

But I agree, my default approach has usually been to only use innerText if it has untrusted content:

So if their demo is this:

    container.SetHTML(`<h1>Hello, {name}</h1>`);
Mine would be:

    let greetingHeader = container.CreateElement("h1");
    greetingHeader.innerText = `Hello, {name}`;
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by itishappy on Tuesday February 24, 2026 @09:58AM (#47137954)
What if I wanted an <h2>?

Edit: I don't mean this flippantly. If I want to render, say, my blog entry on your site, will I need to select every markup element from a dropdown list of custom elements that only accept text a la Wordpress?

Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by DoctorOW on Tuesday February 24, 2026 @05:28PM (#47144220)
If it's anything complex I'm doing it server side, personally
Re:Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection... by itishappy on Tuesday February 24, 2026 @10:23PM (#47146891)
That works fine. That said, client side JS solutions are already quite popular.