mixitup icon indicating copy to clipboard operation
mixitup copied to clipboard

IE 8, 9 throwing error on insert

Open plankguy opened this issue 12 years ago • 4 comments

IE 8 & 9 are throwing an error "Invalid argument." on line 1838. I tracked it down the the target variable being undefined, when calling self._$parent[0].insertBefore(frag, target). I fixed by adding a default to the variable:

target = (function(){
    self._refresh();

    if(self._$targets.length){
        return (args.index < self._$targets.length || !self._$targets.length) ? 
            self._$targets[args.index] :
            self._$targets[self._$targets.length-1].nextElementSibling;
    } else {
        return self._$parent[0].children[0];
    }
})() || null;

I'm not 100% sure if that's the root of the problem, but works for me. Would love to see in a future release, I can submit a pull request, if that'd help.

plankguy avatar Aug 25 '14 20:08 plankguy

Hi guys,

are there any updates about this topic? I faced the same issue in IE 10 and don't know whats going wrong … :(

Thanks and best, Chris

aufdenpunkt avatar Sep 27 '16 12:09 aufdenpunkt

@aufdenpunkt || null was added at the end of the function in the mixitup.js file to fix this problem as @plankguy has posted. This worked for me in IE 10.

You need to add it to this function

target = (function(){ self._refresh();

if(self._$targets.length){
    return (args.index < self._$targets.length || !self._$targets.length) ? 
        self._$targets[args.index] :
        self._$targets[self._$targets.length-1].nextElementSibling;
} else {
    return self._$parent[0].children[0];
}

})();

so it becomes:

target = (function(){ self._refresh();

if(self._$targets.length){
    return (args.index < self._$targets.length || !self._$targets.length) ? 
        self._$targets[args.index] :
        self._$targets[self._$targets.length-1].nextElementSibling;
} else {
    return self._$parent[0].children[0];
}

})() || null;

roshneev avatar Oct 14 '16 10:10 roshneev

Awesome, thanks. Is it possible to add this also in your source? I'm using bower to install all the dependencies and currently I have to use my forked repository of your library, where I fixed this for myself. But in general I prefer to use the repository of the contributor. :)

aufdenpunkt avatar Oct 17 '16 05:10 aufdenpunkt

This should no longer be an issue in MixItUp 3. Let me know if you continue to have any issues thought. https://github.com/patrickkunka/mixitup/releases/tag/v3.0.0

patrickkunka avatar Dec 10 '16 20:12 patrickkunka