I trying to build a minimal optimized HTML template engine in
I want in the most efficient way load a html file (valid XHTML) file
with XmlHttpRequest, parse it and insert into my html document.
var frag = document.createDocumentFragment();
frag.innerHTML = loadedSrc;
> I want in the most efficient way load a html file (valid XHTML) file
> with XmlHttpRequest, parse it and insert into my html document.
You say you want to load a valid XHTML document and then you want to
insert the complete XHTML into another HTML document? I don't understand
that, how does one complete document fit into another document?
As for loading XHTML with XMLHttpRequest in Firefox, either make sure
you serve the XHTML with an XML MIME type or use overrideMimeType to get
Firefox to parse the response as XML. Then you can use DOM Level 2
importNode to import nodes from one document (responseXML) into the
other (document) and afterwards DOM Level 2 Core methods like
appendChild or insertBefore or replaceChild work to have nodes inserted.