Open lostincomputer opened 9 years ago
@mattbradley thoughts on this?
Very nice find. This seems to be another quirk with using jQuery's methods to manage the list of livestamps (similar to #16). Maybe just adding and removing the livestamps from an array would be better. I'll look into this for v2.0.
Memory is not freed when I call the destroy function
Root cause is this line: $livestamps = $livestamps.not($el);
basically, with .not(), the element isn't removed from the array. $livestamps still holds a reference to the element.
Code to reproduce the problem: $('#birth').livestamp(new Date('June 18, 1987')); $('#birth').livestamp('destroy'); $('#birth').livestamp(new Date('June 18, 1987')); $('#birth').livestamp('destroy'); $('#birth').livestamp(new Date('June 18, 1987')); $('#birth').livestamp('destroy');
You will notice that value of $livestamps.selector becomes longer and longer .not().not().not([object Object]) .not().not().not([object Object]).not().not([object Object]) .not().not().not([object Object]).not().not([object Object]).not().not([object Object])