New alternatives to innerHTML have been implemented in browsers. The setHTML function is a safe method that does not execute script, while setHTMLUnsafe is an unsafe method that poses a risk of XSS attacks. The Sanitizer API helps put the naming of setHTMLUnsafe in context. The setHTMLUnsafe function is useful for declarative shadow DOM. The getHTML function allows users to retrieve HTML content, with the ability to serialize shadow DOM.
3 Comments
Sort: