Skip to content

Commit

Permalink
filter onevent attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
aidantwoods committed May 1, 2017
1 parent af04ac9 commit 131ba75
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,22 @@ protected function sanitiseElement(array $Element)
$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;
}

Expand Down

0 comments on commit 131ba75

Please sign in to comment.