JavaScript: Replacement for XMLSerializer.seralizeToString()?

Posted by NRaf on Stack Overflow See other posts from Stack Overflow or by NRaf
Published on 2011-02-06T21:38:23Z Indexed on 2011/02/06 23:25 UTC
Read the original article Hit count: 147

I'm developing a website using the Seam framework and the RichFaces AJAX library (these isn't really all that important to the problem at hand - just some background).

I seem to have uncovered a bug, however, in RichFaces which, in certain instances, will cause AJAX-based updating to fail in IE8 (see here for more info: http://community.jboss.org/message/585737).

The following is the code where the exception is occurring:

var anchor = oldnode.parentNode;
   if(!window.opera && !A4J.AJAX.isWebkitBreakingAmps() && oldnode.outerHTML && !oldnode.tagName.match( /(tbody|thead|tfoot|tr|th|td)/i ) ){
             LOG.debug("Replace content of node by outerHTML()");
             if (!Sarissa._SARISSA_IS_IE || oldnode.tagName.toLowerCase()!="table") {
              try {
               oldnode.innerHTML = "";
              } catch(e){    
               LOG.error("Error to clear node content by innerHTML "+e.message);
      Sarissa.clearChildNodes(oldnode);
              }
             }
             oldnode.outerHTML = new XMLSerializer().serializeToString(newnode);
   }

The last line (the one with XMLSerializer) is where the exception is occurring in IE. I was wondering if anyone knows of any replacement method / library / etc I could use there (only on IE is fine). Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about internet-explorer