fix stripEmptyTextNodes for IE (part of #615337) stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 05 Jan 2010 17:04:29 +0100
branchstable
changeset 4208 b2826afdaf8c
parent 4207 0198acbae080
child 4209 8712d699beb2
fix stripEmptyTextNodes for IE (part of #615337) this does not seem to make the function really work but it does not fail any more
web/data/cubicweb.ajax.js
--- a/web/data/cubicweb.ajax.js	Mon Jan 04 19:02:09 2010 +0100
+++ b/web/data/cubicweb.ajax.js	Tue Jan 05 17:04:29 2010 +0100
@@ -424,11 +424,16 @@
  * takes a list of DOM nodes and removes all empty text nodes
  */
 function stripEmptyTextNodes(nodelist) {
+    /* this DROPS empty text nodes */
     var stripped = [];
     for (var i=0; i < nodelist.length; i++) {
         var node = nodelist[i];
-        if (isTextNode(node) && !node.textContent.strip()) {
-            continue;
+        if (isTextNode(node)) {
+             /* all browsers but FF -> innerText, FF -> textContent  */
+             var text = node.innerText || node.textContent;
+             if (text && !text.strip()) {
+               continue;
+             }
         } else {
             stripped.push(node);
         }