$f =
(string) $filter->
process('<p onerror="alert(0);"></p>', Language::LANGCODE_NOT_SPECIFIED
);
$this->
assertNoNormalized($f, 'onerror', 'HTML filter should remove on* attributes.'
);
$this->
assertSame('<p></p>',
$f);
$f =
(string) $filter->
process('<code onerror> </code>', Language::LANGCODE_NOT_SPECIFIED
);
$this->
assertNoNormalized($f, 'onerror', 'HTML filter should remove empty on* attributes.'
);
// Note - this string has a decoded character.
$this->
assertSame('<code> </code>',
$f);
$f =
(string) $filter->
process('<br>', Language::LANGCODE_NOT_SPECIFIED
);
$this->
assertNormalized($f, '<br />', 'HTML filter should allow line breaks.'
);
$f =
(string) $filter->
process('<br />', Language::LANGCODE_NOT_SPECIFIED
);
$this->
assertNormalized($f, '<br />', 'HTML filter should allow self-closing line breaks.'
);
// All attributes of allowed tags are stripped by default.
$f =
(string) $filter->
process('<a kitten="cute" llama="awesome">link</a>', Language::LANGCODE_NOT_SPECIFIED
);
$this->
assertNormalized($f, '<a>link</a>', 'HTML filter should remove attributes that are not explicitly allowed.'
);
// Now allow the "llama" attribute on <a>.
$filter->
setConfiguration([ 'settings' =>
[