Re: Change DocumentType on a loaded Document
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <ee07b55c-51f5-4127-a479-5e98de8d633c@v29g2000hsf.googlegroups.com> |
On Jan 24, 6:21 pm, Boris Zbarsky <[email protected]> wrote: > [email protected] wrote: > Not really. Why would you want to? To toggle quirks mode on/off? > I am using Mozilla to display a HTML DOM generated by other program. The HTML DOM might change its DocType in between the editings, which was why I wanted to change the DocType on a loaded nsIDOMDocument. After some thoughts, I now decide that there is no need to do it since the parsing is in the other program and Mozilla is sort of just a graphic monitor and I can use its default DocType all the time. > > Is there a way to supply the nsIWebBrowser/nsIDOMWindow with a parsed DOM and let it show it? > > Maybe, sort of. XSLT more or less does that... I am now more interested in getting this one to work. My current setup is first use openUrl() to open "about:blank" page. Then I get a nsIDOMDocument out of it, I clear the body and repopulate it with the HTML DOM from the other program. Sometimes the HTML DOM needs to go through big structural change that I want to batch the changes. I want to apply "doubling buffering" technique, i.e., I can use the nsIDOMImplementation to create a new nsIDOMDocument and apply the changes to this new document behind the scene. At some point, if I can swap out the old nsIDOMDocument from the nsIDOMWindow and let it display the new document, I will be all set. Could you please explain a little more detail how the last step can be done? I also encounter one other problem in this process. Mozilla does not appear to take the <base> I set in the <head> of the DOM, which render all the relative paths unusable. It only appears to take <base> (or the location of the source file if no <base> is specified) when open HTML source using openUrl(). Is there an attribute that I can set in DOM API that will achieve the same effect as openUrl()? Thanks.