<script>
 const html = '<img src onerror=alert(1)>';
 const sanitizer = new goog.html.sanitizer.HtmlSanitizer();
 const sanitized = sanitizer.sanitize(html);
 const node = goog.dom.safeHtmlToNode(sanitized);
 
 document.body.append(node);
 </script>