You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jeff Gerber <jg...@iconclude.com> on 2005/04/18 20:28:33 UTC

fixed issue with tacos:Partial Partial.js

It appears that the javascript that handles the response does not account for
quirks with the FireFox XMLDocument object.  The text nodes seem to have a max
length of 4096 bytes.  I noticed this when I tried to convert my tree component
(not a tacos:tree) to partial rendering.  The tree would truncate after growing
to a certain size.  I eventually figured out that the remaining text is in put
in the sibling nodes.  I tweaked the ‘completed’ function to iterate through the
child nodes and concatenate the text together before setting the innerHTML.  It
seems to fix the problem.  I tested in FireFox 1.0.2 and IE 6.

PartRequest.prototype.completed = function() {
      // FIXME add more error checking
      root = this.transport.responseXML.documentElement;
      partNodes = root.childNodes;
      for (i = 0; i < partNodes.length; i++) {
            part = partNodes.item(i);
            if(part.attributes) {
                  partId = part.attributes[0].value;
                  partElement = document.getElementById(partId);
                  if (partElement) {
                        if (part.childNodes != null && part.childNodes.length > 0){
                              newElementHTML = "";
                              for(ii =0;ii < part.childNodes.length; ii++) {
                                    newElementHTML += part.childNodes[ii].nodeValue;
                              }
                              partElement.innerHTML = newElementHTML;   
                        } else {
                              partElement.parentNode.removeChild(partElement);
                        }
                  }
            }
      }
};



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org