JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript">
function test(string) {
var match = /([\s"']+on\w+)\s*=/i.test(string);
return match ? 'match :(' : 'bypass :)';
}
var s=test("<img/src=x /alt='Img Not Found'onerror=confirm(1)>");
alert(s);
</script>