summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-08-25 14:40:01 +0000
committerArtur Signell <artur.signell@itmill.com>2011-08-25 14:40:01 +0000
commit1ec08dec729c799cccb6290e6afb507ba2740285 (patch)
tree4b054de5de898b53e949a1b6aaef8f301a7a49f2
parentd709b3bb203d289698706fd76d0b6963659c2823 (diff)
downloadvaadin-framework-1ec08dec729c799cccb6290e6afb507ba2740285.tar.gz
vaadin-framework-1ec08dec729c799cccb6290e6afb507ba2740285.zip
#7478 Util.escapeHtml incorrectly converts newline to <br> and space to "&nbsp;" in IE6-IE8
svn changeset:20662/svn branch:6.7
-rw-r--r--src/com/vaadin/terminal/gwt/client/Util.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/Util.java b/src/com/vaadin/terminal/gwt/client/Util.java
index 7edad795fe..9d2f1d3968 100644
--- a/src/com/vaadin/terminal/gwt/client/Util.java
+++ b/src/com/vaadin/terminal/gwt/client/Util.java
@@ -248,7 +248,14 @@ public class Util {
*/
public static String escapeHTML(String html) {
DOM.setInnerText(escapeHtmlHelper, html);
- return DOM.getInnerHTML(escapeHtmlHelper);
+ String escapedText = DOM.getInnerHTML(escapeHtmlHelper);
+ if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() < 9) {
+ // #7478 IE6-IE8 "incorrectly" returns "<br>" for newlines set using
+ // setInnerText. The same for " " which is converted to "&nbsp;"
+ escapedText = escapedText.replaceAll("<(BR|br)>", "\n");
+ escapedText = escapedText.replaceAll("&nbsp;", " ");
+ }
+ return escapedText;
}
/**