Goodbye innerHTML, Hello setHTML: Stronger XSS Protection in Firefox 148
Firefox 148 is the first browser to ship the standardized Sanitizer API, whose setHTML() method sanitizes untrusted HTML as it is inserted into the DOM, for example stripping an <img> with an onclick handler while keeping safe elements like <h1>. Developers can replace error-prone innerHTML assignments with setHTML() with minimal code changes and supply a custom configuration of allowed or removed elements and attributes. Combined with Trusted Types, a strict policy can permit setHTML() while blocking other unsafe insertion sinks, offering XSS protection that is easier to adopt than Content-Security-Policy.
Related posts
- New WebKit Features in Safari 15.5
WebKit easyNoviceSafari 15.5 is mostly a polish and bug-fix release, adding three developer-facing technologies: the HTML `inert` attribute, which makes an element non-interactive and hides it from assistive technologies; the CSP Level 3 `worker-src` directive for restricting worker script sources; and WKWebView `minimumViewportInset`/`maximumViewportInset` APIs so apps can support the new CSS small, large and dynamic viewport units. A long list of fixes covers CSS (`position: sticky`, `aspect-ratio`, `background-clip: text`), Web APIs, CSP, media/HLS playback, WebRTC, WebGL multisampling, WebAuthn spec alignment and Safari extensions.
- In March, we see Firefox 87
Mozilla Hacks mediumAdeptFirefox 87 enables the beforeinput event and InputEvent.getTargetRanges() by default, letting web apps inspect and cancel text edits in inputs and contenteditable elements before the DOM changes, with an example that protects metadata spans inside an editable comment. DevTools gains prefers-color-scheme light/dark emulation and a :target pseudo-class toggle. The default Referrer-Policy becomes strict-origin-when-cross-origin, so paths and query strings are no longer sent cross-origin. SmartBlock substitutes bundled stand-ins for blocked tracking scripts so sites keep working, and VoiceOver screen reader support now ships on macOS.
- New to the web platform in July
web.dev easyNoviceChrome 151, Firefox 153 and Safari 26.6 reached stable in July 2026. Firefox relaxes HTML parsing inside <select> to prepare for customizable selects, and adds desktop Picture-in-Picture, the Intl.Locale info getters (now Baseline Newly available) and IndexedDB getAllRecords(). Chrome adds the ruby-overhang CSS property, declarative manual slot assignment via shadowrootslotassignment, an animation attribute on AnimationEvent/TransitionEvent, textStream() on Response/Request/Blob, and the <usermedia> permission element, while Safari ships CSS and cookie bug fixes. Betas preview Chrome 152, Firefox 154 WebRTC transport APIs and a large Safari 27 CSS and accessibility feature set.
- New WebKit Features in Safari 15.4
WebKit mediumAdeptSafari 15.4 ships over 70 WebKit additions, led by the <dialog> element with ::backdrop, lazy-loaded images, the :has() parent selector (shipped first in Safari), Cascade Layers, CSS containment, and new small/large/dynamic viewport units (svh, lvh, dvh and friends) that fix mobile viewport sizing. Other web platform additions include BroadcastChannel, Web Locks, structuredClone, Array at()/findLast(), Object.hasOwn(), and several Intl API upgrades. Web apps gain manifest-declared icons and ServiceWorker Navigation Preload. Security changes add CSP Level 3 features such as 'strict-dynamic' and remove the XSS Auditor, and many -webkit- prefixed properties now have unprefixed equivalents.
- Declarative Shadow DOM
WebKit mediumAdeptSafari Technology Preview 162 enables declarative shadow DOM by default. A `template` element with a `shadowrootmode` attribute attaches its content as a shadow root on the parent element, so shadow trees work in server-side rendering and in no-JavaScript contexts such as email clients. Scripts can later reach the shadow root through `ElementInternals`. For backwards compatibility, `attachShadow()` on such an element returns the existing root emptied of its children instead of throwing. Parser APIs like `innerHTML` and `DOMParser` deliberately ignore the attribute to avoid new XSS vectors. A new `cloneable` option, set automatically for declarative roots, lets `cloneNode()` and `importNode()` copy shadow roots along with their hosts.