MDL-66104 output: HTMLPurifier to allow <nolink> tags everywhere
Before the patch, HTMLPurifier was instructed to handle <nolink> tags in block mode. That implies that any block tag enclosing it had to be closed for HTML compliance. But <noscript> tags are not part of the final output (they are removed) but just internally used to skip filtering certain areas. So they can be virtually everywhere, HTMLPurifier just should allow them without any change, both to parent or children tags.
This commit is contained in:
@@ -64,6 +64,11 @@ class core_htmlpurifier_testcase extends basic_testcase {
|
||||
$text = '<nolink>xxx<em>xx</em><div>xxx</div></nolink>';
|
||||
$result = purify_html($text, array());
|
||||
$this->assertSame($text, $result);
|
||||
|
||||
// Ensure nolink doesn't force open tags to be closed, so can be virtually everywhere.
|
||||
$text = '<p><nolink><div>no filters</div></nolink></p>';
|
||||
$result = purify_html($text, array());
|
||||
$this->assertSame($text, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1856,7 +1856,7 @@ function purify_html($text, $options = array()) {
|
||||
}
|
||||
|
||||
if ($def = $config->maybeGetRawHTMLDefinition()) {
|
||||
$def->addElement('nolink', 'Block', 'Flow', array()); // Skip our filters inside.
|
||||
$def->addElement('nolink', 'Inline', 'Flow', array()); // Skip our filters inside.
|
||||
$def->addElement('tex', 'Inline', 'Inline', array()); // Tex syntax, equivalent to $$xx$$.
|
||||
$def->addElement('algebra', 'Inline', 'Inline', array()); // Algebra syntax, equivalent to @@xx@@.
|
||||
$def->addElement('lang', 'Block', 'Flow', array(), array('lang'=>'CDATA')); // Original multilang style - only our hacked lang attribute.
|
||||
|
||||
Reference in New Issue
Block a user