Skip to content

Commit

Permalink
Support browsers where getHTML is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemanrubia committed Jul 30, 2024
1 parent c8dbd3d commit 626a4f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/trix/models/html_sanitizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const DEFAULT_FORBIDDEN_ELEMENTS = "script iframe form noscript".split(" ")

export default class HTMLSanitizer extends BasicObject {
static setHTML(element, html) {
element.innerHTML = new this(html).sanitize().getHTML()
const sanitizedElement = new this(html).sanitize()
const sanitizedHtml = sanitizedElement.getHTML ? sanitizedElement.getHTML() : sanitizedElement.outerHTML
element.innerHTML = sanitizedHtml
}

static sanitize(html, options) {
Expand Down

0 comments on commit 626a4f4

Please sign in to comment.