Bug Tracker

Opened 14 years ago

Closed 12 years ago

Last modified 11 years ago

#3521 closed bug

remove() fails with IE & ajax

Reported by: arobinson Owned by:
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc: arobinson, flesler
Blocked by: Blocking:


When trying to manipulate the xhr responseXML when complete, I get errors in IE7 in jQuery 1.2.6.

The error happens at line 666 (go figure):

data: function( elem, name, data ) {

elem = elem == window ?

windowData : elem;

var id = elem[ expando ];

Compute a unique ID for the element if ( !id )

id = elem[ expando ] = ++uuid;

The code I am using (xml is the xhr.responeXML): var $scripts = $('script', xml).remove();

If I remove the call to "remove()" the error goes away.

Is there a way around this?

Change History (5)

comment:1 Changed 14 years ago by flesler

Cc: arobinson flesler added
need: ReviewTest Case

Can you make a test case to reproduce the problem ?

comment:2 Changed 14 years ago by n_2

I have this same problem, works fine in ff, fails in ie at line 666. (loading xml from a string, rather than ajax call)

Here is a test case that works in ff, fails in ie. (latest version of jquery, 1.26)

<script type="text/javascript">
    //Xml Parser object
    var xmlParser = {
        xmlDoc : null,
        //Loads the xml string into a xml doc
        loadFromDb : function(xmlString) {
            if(window.ActiveXObject) { //ie
                this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            else { //ff/opera
                var parser = new DOMParser();
                this.xmlDoc = parser.parseFromString(xmlString,"text/xml");
        toString : function() {
            if (window.ActiveXObject)
                return this.xmlDoc.xml;
                return (new XMLSerializer()).serializeToString(this.xmlDoc);
        deleteTest : function() {
            $(this.xmlDoc).find("gd > cd > uid").remove();

    //Our test xml string
    var xml = "<gd><cd><uid>0</uid><tm>0</tm><w>0</w><h>0</h></cd></gd>";
    //Load our xml up

    //And try and delete the uid node
    //Works fine in ff, fails in ie 7, "Object doesn't support this property or method.
    //Line 666 of jquery: id = elem[ expando ] = ++uuid;

comment:3 Changed 14 years ago by MaRsuPiLaMi

Another much simplier test-case. I provided a cross browser implementation so you can test it quite easyly.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script text="JavaScript" type="text/javascript" src="jquery-1.2.6.js"></script>
<script text="JavaScript" type="text/javascript">
function getDomFromXml(xml) {
        if (typeof ActiveXObject != 'undefined') {
                var dom = new ActiveXObject("Microsoft.XMLDOM");
                dom.async = false;
        } else {
                parser = new DOMParser();
                dom = parser.parseFromString(xml, "text/xml");
        return dom;

function getXmlFromDom(xmlDom) {
    if (typeof ActiveXObject != 'undefined') {
        return xmlDom.xml;
    } else {
        return (new XMLSerializer()).serializeToString(xmlDom);

    // get 2 doms
    dom = getDomFromXml("<container><repr type=\"text\"></repr></container>");
    anotherDom = getDomFromXml("<container><blubb type=\"text\">bla</blubb></container>");
    repr = $("repr",dom);
    blubb = $("blubb",anotherDom);
    //append the <blubb> element to the <repr> element
    // should remove the appended <blubb> element
    // ie never reach this line

comment:4 Changed 12 years ago by snover

Status: newpending

This ticket has been marked as missing a test case. In an effort to reduce the number of outstanding tickets in the bug tracker, it will be closed automatically in 30 days. In order to prevent this from happening, please provide a working test case. If a test case has already been provided and our records are wrong, please respond to the ticket so that it can be fixed. Thank you!

comment:5 Changed 12 years ago by trac-o-bot

Status: pendingclosed

Automatically closed due to 14 days of inactivity.

Note: See TracTickets for help on using tickets.