Web features explorer

Unsanitized HTML parsing methods

Newly available since 2024-07-09
Tags: api

The Document.parseHTMLUnsafe() static method parses HTML into a DOM tree, while the setHTMLUnsafe() method of Element and ShadowRoot parses and inserts HTML into an existing tree. No sanitization applies to these methods, so never call them with user-provided HTML strings. To learn more, see Document: parseHTMLUnsafe() static method, Element: setHTMLUnsafe() method, ShadowRoot: setHTMLUnsafe() method at MDN.

Compatibility