Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"xnlns" node attribute removed when using XMLHttpRequest.send( document ) [ or XMLSerializer.serializeToString( node ) ] in firefox 3

9 views
Skip to first unread message

pet...@xandros.com

unread,
Dec 7, 2007, 11:28:56 AM12/7/07
to
Maybe this belongs in the javascript section but here we go anyway.

I've been working on getting my javascript code compatable with
Firefox 3 and ran into a problem.
I am switching alot of code blocks from:

appendNode( node );

to something similar to:

var newNode = document.importNode( node, true );
appendNode ( newNode );

to comply with the new strict enforcement of "nodes cannot be owned
by two different documents" in firefox 3 (gecko 1.9).

The problem am I running into is that when sending a document via AJAX
using XMLHttpRequest.send( document ) method it looks like the
appended node is losing it's "xmlns" attribute when undergoing
serialization. This can also be reproduced by using
XMLSerializer.serializeToString( node ) call.

Running the same code in firefox 2 doesn't cause this issue.

So my question is, what's changed in firefox 3? What do I have to do
to maintain the "xmlns" attribute on this appended node when sending
via XMLHttpRequest?

I can throw together a test example if it is necessary.

Axel Hecht

unread,
Dec 7, 2007, 1:38:54 PM12/7/07
to

Firefox 2 XMLSerializer had a bug when child nodes of an element with a
default namespace had no namespace, IIRC. You might be hitting that.

Like, if you newNode has no namespace, the Fx3 XMLSerializer will ensure
that the serialized document has xmlns attributes ensuring that the
default namespace is none. Note that setting the xmlns attribute on a
node does not change the namespace, and that the xmlns attributes in the
serialization will be set such that the original namespaces will be
restored on parsing. Additionally, no, there is no way to change the
namespace of an existing DOM node (at least I'm pretty sure there isn't).

Axel

0 new messages