public static function removeJavascriptEvents(string $html) : string
{
// A tag can have multiple events, therefore it is necessary to process the source multiple times
while (preg_match('~<[a-z][a-z0-9]*[^>]*?\\s+on[a-z]+="[^"]*"~is', $html)) {
$html = preg_replace('~(<[a-z][a-z0-9]*[^>]*?)\\s+on[a-z]+="[^"]*"~is', '\\1', $html);
}
return $html;
}