Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: What XMLHttpRequest.responseXML good for (in XHTML)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What XMLHttpRequest.responseXML good for (in XHTML)?



John,
Response is not empty and xhtml.documentElement.getElementsByTagName ( "body" ) returns an array of 1 element and this element is "body". And body.firstChild returns an element which is #text. and it has not null nextSibling which is happen to be an Element ('h1' in my particular case). And as soon as script trying to appendChild with this element - Safari blow.


Andrei

On Oct 5, 2006, at 4:31 PM, John Jameson wrote:

Hi Andrei,

You need to check that responseXML is not empty. If the MIME type of the
response is not text/xml then the content will be in responseText.


HTH.

Regards,

John Jameson.


Message: 2 Date: Wed, 4 Oct 2006 19:53:01 -0400 From: Andrei Tchijov <email@hidden> Subject: What XMLHttpRequest.responseXML good for (in XHTML)? To: Apple Web Dev list <email@hidden> Message-ID: <email@hidden> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed

I am using some AJAX (via prototype.js ) to get content of XHTML
file.  AJAX works perfectly. I am getting wonderful XML which looks/
sounds/smells like DOM XML representing my XHTML page. The problem it
that every time I am trying to "move" nodes from XML which I got via
AJAX to my XHTML page DOM, Safari crash.  These are relevant bits of
my code:

...
function importXHTML( url ) {
    var myAjax = new Ajax.Request( url, { method: 'get', asynchronous:
false });
    if( myAjax.transport.status != 200 ) {
        return null;
    }
    return myAjax.transport.responseXML;
}
...
var xhtml = importXHTML( fullHref );

var bodyElement = xhtml.documentElement.getElementsByTagName( "body" )
[0];
var nextChild = bodyElement.firstChild;

while( nextChild ) {
    target.appendChild( nextChild );
    nextChild = nextChild.nextSibling;
}
...

To be precise, Safari crash trying to "appendChild" first element
node (the very first node happen to be #text and it does not case any
problems ).

Am I doing something illegal?  The very same code works happily on
Firefox.

Your comments will be highly appreciated,

Andrei Tchijov
Leaping Bytes, LLC


_______________________________________________ Do not post admin requests to the list. They will be ignored. Web-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: What XMLHttpRequest.responseXML good for (in XHTML)? (From: John Jameson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.