Re: External node troubles [FF3 RC1]

noon <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <04897b0b-9a1c-4eb9-a828-c34a5de1f58b@y21g2000hsf.googlegroups.com>
On May 22, 5:07 pm, Boris Zbarsky <[email protected]> wrote:
> You're really assigning that to adoptNode?  That's a little odd...  And why not
> use the responseXML instead of parsing it yourself?  In any case...

Yes I was shooting in the dark with the adoptNode bit, im not very
familiar with it yet.

> You're passing |doc| as the context to document.evaluate.  The node passed to
> document.evaluate as the context must either be |document| or a node whose
> ownerDocument is |document|.  That's pretty clearly documented in the DOM XPath
> spec.

Maybe you're unfamiliar with the DOMParser? parseFromString returns a
DOM document. http://www.xulplanet.com/references/objref/DOMParser.html
If I am mistaken in some way, please let me know.

On another note, the replacing the rs function with the following code
works just fine in FF2, but not FF3

function rs(html) {
	$('test').innerHTML = html.split(/<body[^>]*>((?:.|\n)*)<\/body>/i)
[1]; // xmlserializer needs a dom object
	var p = new DOMParser();
	var xs = new XMLSerializer();

	var doc = p.parseFromString(xs.serializeToString($('test')),"text/
xml");

	var alt = $x("//IMG", doc);
	$('text').textContent = alt[0] + ' and ' + alt.length; // result:
undefined and 0
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.