Description
According to the documentation (link) setting htmlcleaner.id to an empty string or removing the property altogether should have the functional effect that all incoming HTML is preserved. As a result of the refactoring done in CMS-1610 and CMS-8638 the HtmlCleaner is now also invoked to rewrite the metadata saved for links. As part of this fix make update the aforementioned documentation page to state the functional effect rather than the implementation and fix the problem that the current configuration strips <style> elements.
The current configuration of HtmlCleaner currently strips out <style> elements. This can be reproduced by adding the following test case to org.hippoecm.frontend.plugins.richtext.htmlcleaner.HtmlCleanerPluginTest
@Test public void testStyle() throws Exception { final HtmlCleanerPlugin htmlCleanerPlugin = new HtmlCleanerPlugin(null, getPluginConfig()); String html = htmlCleanerPlugin.clean("<style>h1 {color:black;}</style>"); assertEquals("<style>h1 {color:black;}</style>", html); }
When checking out the actual HtmlCleaner project, adding the following unit test to org.htmlcleaner.HtmlCleanerTest will pass.
@Test public void styleElement() throws Exception { assertCleaned( "<style>h1 {color:black;}</style>", "<html>\n" + "<head><style>/*<![CDATA[*/\n" + "h1 {color:black;}\n" + "/*]]>*/</style></head>\n" + "<body /></html>" ); }
A newer version of HtmlCleaner is also available (2.14), bumping the dependency to that version does not fix the problem.