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:
parent
af04ac92e2
commit
131ba75851
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user