legshooter/addel

Deleted event not firing correctly

sarfraznawaz2005 opened this issue · 2 comments

It seems deleted event is being fired before element is actually removed from the DOM. I tested with following code:

        .on('addel:deleted', function (event) {
            alert($('.addel-target').length);
            alert($('.addel-target:visible').length);
            //calculateGrandTotal();
        });

The alert displays the same length even after an element is deleted.

For now, I am doing this to avoid this issue:

        .on('addel:deleted', function (event) {
            // calculate total after some while because addel does not delete element
            // from DOM immediately.
            window.setTimeout(calculateGrandTotal, 3000);
        });

I think the problem is that it doesn't wait for the animation to end. Thanks for reporting, I'll push out a fix soon.

Released v1.3.2 that fixes this.