1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

filter onevent attributes

This commit is contained in:
Aidan Woods 2017-05-01 15:44:04 +01:00
parent af04ac92e2
commit 131ba75851
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -1513,6 +1513,22 @@ class Parsedown
$Element = $this->filterUnsafeUrlInAttribute($Element, $safeUrlNameToAtt[$Element['name']]);
}
if ( ! empty($Element['attributes']))
{
# clear out nulls
$Element['attributes'] = array_filter(
$Element['attributes'],
function ($v) {return $v !== null;}
);
$onEventAttributes = preg_grep('/^\s*+on/i', array_flip($Element['attributes']));
foreach ($onEventAttributes as $att)
{
unset($Element['attributes'][$att]);
}
}
return $Element;
}