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"onerror =alert(1)>');
alert(s);
</script>