Skip to content

Commit 626a4f4

Browse files
committed
Support browsers where getHTML is not supported
1 parent c8dbd3d commit 626a4f4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/trix/models/html_sanitizer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const DEFAULT_FORBIDDEN_ELEMENTS = "script iframe form noscript".split(" ")
88

99
export default class HTMLSanitizer extends BasicObject {
1010
static setHTML(element, html) {
11-
element.innerHTML = new this(html).sanitize().getHTML()
11+
const sanitizedElement = new this(html).sanitize()
12+
const sanitizedHtml = sanitizedElement.getHTML ? sanitizedElement.getHTML() : sanitizedElement.outerHTML
13+
element.innerHTML = sanitizedHtml
1214
}
1315

1416
static sanitize(html, options) {

0 commit comments

Comments
 (0)