-
Bug
-
Resolution: Fixed
-
Minor
-
3.6.2, 3.7, 3.8
-
MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
-
MOODLE_36_STABLE, MOODLE_37_STABLE
-
While working on MDL-58680 tests, it was discovered that clean_text(), using the HTML Purifier... was breaking some content when <nolink> tags are used.
So, for example, this html:
<p>Hello, <nolink>world!</nolink></p>
|
Is being converted to:
<p>Hello, </p><nolink>world!</nolink>
|
When the correct (expected) behavior, is to keep the html unmodified, because those tags should be allowed everywhere.
Tracing back the problem it seems that @ MDL-24223, together with an HTMLPurifier upgrade, the behavior was changed:
- $this->addElement('nolink', 'Inline', 'Flow');
|
+ $def->addElement('nolink', 'Block', 'Flow', array());
|
Note that, surely, this has been unnoticed along all these years because we switched to the <span class="nolink> alternative for user-entered content in general long ago.
But, irrespectively of that, the <nolink> ones should be working as expected because they can be used programmatically to skip filtering here and there (like we are trying to do @ MDL-58680) with the advantage of being removed before the final output happens.
So, this issue is about to revert the handling of <nolink> tags back to "Inline" mode, that leads to the correct behavior of, simply, keeping HTML unmodified, without any early closing of tags (and cover the behavior with tests, to ensure it remains constant).
Ciao