views:

94

answers:

1

Hi there. I have a javascript function that gets a DIV by an ID and makes a clone. Then, removes the original DIV from DOM and inserts the cloned object..Everything works fine, except in IE, because the original DIV is never removed...

var loadingDiv = $(Sybil.conf.loadingDivId),
    loadingClone = loadingDiv.clone(true);

    console.log($$('.loadingImg'));
    loadingDiv.remove();
    //Insert the loading div on the page again
    elt.insert({after: loadingClone});
    [loadingClone].invoke(func);
    console.log($$('.loadingImg'));

The div also has a span inside with the class "loadingImg", so i just used the console.log to check how many elements there are. FF always prints [span.loadingImg] but IE prints [span.loadingImg,span.loadingImg] on the second console.log...
Any idea of what might be happening? Thanks

A: 

Solved..nothing to do with the javascript actually.. The div i was cloning had a span inside, but the span was not correctly closed, which makes IE goes mad..
Lesson learned: if you know everything is correct and IE is freaking out, go search for invalid HTML

Gonçalo Queirós