Special XML conversion code for Firefox >= 20.0
authorJoey Schulze <joey@infodrom.org>
Mon, 21 Sep 2015 10:47:49 +0000 (12:47 +0200)
committerJoey Schulze <joey@infodrom.org>
Mon, 21 Sep 2015 10:47:49 +0000 (12:47 +0200)
This patch is required due to changed behaviour of the XML parser
in XmlHttpRequest that parses XML responses from the AJAX/SQL
backend.

Firefox < 20.0    <foo> was parsed and returned as <bla>
Firefox >= 20.0   <foo> is parsed and returned as &lt;bla&gt;

This breaks Icons and other HTML code in Rico.LiveGrid cells

Addendum: Chrome alias WebKit seems to behave like Firefox >= 20.0 as well

minsrc/rico.js

index 55287bf..9c8e0ef 100644 (file)
@@ -184,7 +184,13 @@ Rico.getContentAsString=function( parentNode, isEncoded ) {
 };
 
 Rico._getEncodedContent=function(parentNode) {
 };
 
 Rico._getEncodedContent=function(parentNode) {
-  if (parentNode.innerHTML) return parentNode.innerHTML;
+  if (parentNode.innerHTML) {
+    if (Rico.isGecko && navigator.productSub >= "20100101")
+      parentNode.innerHTML.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
+    else
+      return parentNode.innerHTML;
+  }
+
   switch (parentNode.childNodes.length) {
     case 0:  return "";
     case 1:  return parentNode.firstChild.nodeValue;
   switch (parentNode.childNodes.length) {
     case 0:  return "";
     case 1:  return parentNode.firstChild.nodeValue;