diff --git a/lib/tests/htmlpurifier_test.php b/lib/tests/htmlpurifier_test.php
index e14b3191fdf..f1ae916c93a 100644
--- a/lib/tests/htmlpurifier_test.php
+++ b/lib/tests/htmlpurifier_test.php
@@ -64,6 +64,11 @@ class core_htmlpurifier_testcase extends basic_testcase {
$text = 'xxxxxxxx
';
$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 = '
no filters
';
+ $result = purify_html($text, array());
+ $this->assertSame($text, $result);
}
/**
diff --git a/lib/weblib.php b/lib/weblib.php
index 73fbcf94a2a..6e66c484a7c 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -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.