Subj : Re: appendChild() with e4x
To : netscape.public.mozilla.jseng
From : Martin Honnen
Date : Fri Aug 26 2005 08:25 pm
Marco Mariani wrote:
> You're right as far as my example is concerned, but I've replaced
> innerHTML=
Text
with innerHTML=Text, the
> text is italic and the DOM inspector sees the tag too.
As I said, the toString method of the object is called. And toString of
XML objects delivers different results depending on the nesting, while
toString called on
Text
gives the string
'Text'
toString called on
Text
gives the string
'Text'
So if you really want consistent results and have a need to use an XML
object on the right hand side of an innerHTML assignment then you should
script
element.innerHTML = xmlObject.toXMLString()
But obviously that is no DOM<-->E4X integration, it is just serializing
the native XML object to XML markup on the right side and then HTML or
XHTML parsing of that markup when the innerHTML is created.
--
Martin Honnen
http://JavaScript.FAQTs.com/
.