Opened 15 years ago
Closed 15 years ago
#1919 closed bug (invalid)
Can't clone() an XML document in Safari.
Reported by: | sunetos | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | safari, xml, ajax, clone | Cc: | |
Blocked by: | Blocking: |
Description
In jQuery 1.2.1, I am unable to use .clone() on an XML document in Safari. Here is the method I am using:
function loadSprites(callbackFunc) {
var worldId = currentWorldId; $.ajax({
url: '/api/' + apiVersion + '/' + apiKey + '/rest/get/style-sheet/worldId=' + worldId + '&ssType=sprite', cache: apiCaching, async: false, type: 'GET', dataType: 'xml', timeout: apiTimeout, error: function(){
alert('Areae Web Services did not respond. Please try again in a few minutes.');
}, success: function(xml){
xmlCachesprite? = $(xml).clone(); xml cloning doesn't work in safari xmlCachesprite? = $(xml);
var browseContainer = $('#media-tab-browse'); var listContainer = $('#media-tab-list');
loadArtAssetBrowser(browseContainer, listContainer, xml, 'sprite', false, selectArtFromDialog, function() {
loadArtAssetBrowser($('#browse-sprites'), undefined, xml, 'sprite', true, undefined, callbackFunc);
});
}
});
}
I left some of the other misc. code in place just to complete the example. Anyway, if I use the .clone() version, it works in Firefox but not Safari (haven't tried other browsers yet).
Change History (2)
comment:1 Changed 15 years ago by
Component: | ajax → core |
---|
comment:2 Changed 15 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Although this might work in Firefox this isn't intended. Clone is meant for nodes, not for documents. If you want to clone the document you can clone the documentElement like
which works in all browsers. clone() is working as intended in this case.