[Javascript] document.createElement("TBODY")

Paul Novitski paul at juniperwebcraft.com
Tue Apr 17 21:23:49 CDT 2007


At 4/17/2007 06:50 PM, Billy Reisinger wrote:
>I've encountered situations in which I am not in control of the
>server that is returning the content, and that server is returning a
>content type header that is unfriendly with using responseXML.  In
>those cases, I have felt justified in using a responseText /
>innerHTML solution, with the caveat that I have to wait about 20
>milliseconds for the browser to parse the innerHTML insertion before
>doing any DOM manipulation on it.  Fun fun.


Perhaps you could find a way to watch for when the parsing is 
complete -- say by appending a unique element to the end of the text 
before innerHTMLing it and then looping a timer until it appears in the DOM.

Or you could parse the incoming HTML and use DOM methods to insert it 
into the document.  This may sound like an overblown solution but 
there are simple ways to do it, pushing & popping a stack to ensure 
that all the appropriate tags are closed, etc.  If the incoming 
stream is so unpredictable that it chokes an XML parser, parsing it 
yourself might at least ensure that everything you inserted was well formed.

Regards,

Paul
__________________________

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 




More information about the Javascript mailing list