[Javascript] document.createElement("TBODY")

Scott Reynen scott at randomchaos.com
Wed Apr 18 07:09:46 CDT 2007


On Apr 17, 2007, at 9:23 PM, Paul Novitski wrote:

> 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.

This suggests what I think is a false equivalence between HTML and  
XML parsing.  It's my understanding that XML parsers are required by  
the spec to choke on invalid input.  But HTML parsers are not, and  
are designed to accept all manner of "tag soup."  So innerHTML can  
tolerate errors that responseXML can not.  It's good to check for  
errors using innerHTML, but it's not completely necessary.

Peace,
Scott




More information about the Javascript mailing list