vmassol (SVN) wrote:
Author: vmassol
Date: 2009-06-19 21:18:47 +0200 (Fri, 19 Jun 2009)
New Revision: 21360
Modified:
platform/core/branches/xwiki-core-1.8/xwiki-xml/src/main/java/org/xwiki/xml/XMLUtils.java
platform/core/branches/xwiki-core-1.8/xwiki-xml/src/test/java/org/xwiki/xml/internal/html/DefaultHTMLCleanerTest.java
Log:
XWIKI-4005: HMTL Cleaner should not expand empty elements for BR and HR in order to
support IE6
Modified:
platform/core/branches/xwiki-core-1.8/xwiki-xml/src/main/java/org/xwiki/xml/XMLUtils.java
===================================================================
---
platform/core/branches/xwiki-core-1.8/xwiki-xml/src/main/java/org/xwiki/xml/XMLUtils.java 2009-06-19
16:35:08 UTC (rev 21359)
+++
platform/core/branches/xwiki-core-1.8/xwiki-xml/src/main/java/org/xwiki/xml/XMLUtils.java 2009-06-19
19:18:47 UTC (rev 21360)
@@ -213,7 +225,16 @@
format.setOmitDeclaration(omitDeclaration);
XMLOutputter outputter = new XWikiXMLOutputter(format, omitDoctype);
- return outputter.outputString(jdomDoc);
+ String result = outputter.outputString(jdomDoc);
+
+ // Since we need to support IE6 we must generate compact form for the following
HTML elements (otherwise they
+ // won't be understood by IE6):
+ for (String specialElement : OMIT_ELEMENT_CLOSE_SET) {
+ result =
result.replaceAll(MessageFormat.format("<{0}></{0}>",
specialElement),
Shouldn't this be something like "<{0}[^>]*+></{0}>"? I doubt
that there
really is <img></img>, and if it is, it won't make much difference which
way it's written.
+
MessageFormat.format("<{0}/>", specialElement));
+ }
+
+ return result;
--
Sergiu Dumitriu
http://purl.org/net/sergiu/