Yeah, and in fact, this will break in Firefox 3, since you can no
longer use foreign elements in a document, it has to adopt them first.
So it's good that we'd be fixing this now :-)

--John

On 7/23/07, Mike Alsup <[EMAIL PROTECTED]> wrote:

var b = $("hi:first", xml);
var node = $("<div class='group' >xxx</div>");
node.appendTo(b);

Looking at the code above I would assume the problem is that we are
creating "node" using the current document and then trying to append
that node to an element in a different document.  This, of course,
won't work.

Mike




On 7/23/07, John Resig <[EMAIL PROTECTED]> wrote:
>
> Yeah, it does seem like there's something tricky at play here, I've
> created a ticket to track this:
> http://dev.jquery.com/ticket/1419
>
> I'll see if I can get a fix for this in for 1.1.4.
>
> --John
>
> On 7/23/07, Andy Martone <[EMAIL PROTECTED]> wrote:
> >
> > I'm having a similar problem in IE.  However, my code looks like this
> > (using your syntax for creating the XML document):
> >
> > var hiNode = $("hi", xml);
> > hiNode.text("foo");
> >
> > When I run this in Firefox, the hi node in the XML document gets a
> > text node with a value of "foo" appended to it.  However, I get a type
> > mismatch error in IE.
> >
> > I can use the .text() function to retrieve text nodes from XML
> > documents - can I also use it to set text nodes?
> >
> > Any help is appreciated!
> >
> > On Jul 3, 9:09 am, "[EMAIL PROTECTED]"
> > <[EMAIL PROTECTED]> wrote:
> > > Hi... First post, so be gentle...
> > >
> > > I am trying to append a new entry into anXMLdocument.  This works
> > > fine in FF but fails with a 'Type mismatch' error (line 170) in IE.
> > >
> > > By using the .toXML() plugin, the output is '<hi><DIV
> > > class="group">xxx</DIV><BUDGET _moz-userdefined=""><CAT _moz-
> > > userdefined="">xxx</CAT></BUDGET></hi>'
> > >
> > > I have tried in 1.1.3 & 1.1.2, both give the same error in IE.
> > >
> > > function loadXML(text) {
> > >         var xmlDoc = "";
> > >         // code for IE
> > >         if (window.ActiveXObject) {
> > >                 xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
> > >                 xmlDoc.async="false";
> > >                 xmlDoc.loadXML(text);
> > >         }
> > >         // code for Mozilla, Firefox, Opera, etc.
> > >         else if (document.implementation &&
> > >                        document.implementation.createDocument) {
> > >                         var parser=new DOMParser();
> > >                 var xmlDoc=parser.parseFromString(text,"text/xml");
> > >         }
> > >         else {
> > >           alert('Your browser cannot handle this script');
> > >         }
> > >         return xmlDoc;
> > >
> > > }
> > >
> > > $(document).ready(function(){
> > >         var fred="<hi></hi>";
> > >         console.log(fred);
> > >         // Push throughXMLprocessor
> > >        xml= loadXML(fred);
> > >
> > >         var b = $("hi:first",xml);
> > >         var node = $("<div class='group' >xxx</div>");
> > >         node.appendTo(b);
> > >
> > > });
> >
> >
>

Reply via email to