Can I use 'about:blank' as target document?
"Michael Vincent van Rantwijk, MultiZilla" <[email protected]> Wed, 04 Apr 2007 21:33:13 +0200
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Message-ID | <[email protected]> |
Can I use 'about:blank' as 'targetDocument' in the following example:
var newFragment = processor.transformToFragment(xmldoc, targetDocument);
I ask this because I don't see anything in the DOM when I the snippet
below to insert it into the DOM:
targetDocument = xmldoc;
_documentElement = targetDocument.documentElement;
// Remove everything up to the document's <head> element
while (_documentElement.hasChildNodes()) {
_documentElement.removeChild(_documentElement.firstChild);
}
// Import <head> and <body> elements from the document fragment
for (var i = 0; i < newFragment.firstChild.childNodes.length; i++) {
var newNode =
targetDocument.importNode(newFragment.firstChild.childNodes[i], true);
_documentElement.appendChild(newNode);
}
Note: everything I expect (all elements/children) are part of the
'newFragment' so that can't be the problem.
Thanks,
Michael