I've had issues with memory leaks when creating and removing many Kalendae instances on a single page. Particularly the mousedown event handler that is added to window.document always leaves a reference to the original object, retaining it in memory until page reload. This patch adds a destroy method which simply removes these handlers.
Also: sometimes window.getComputedStyle returns null. I've added a few lines to prevent this from breaking Kalendae by letting getStyle return an empty string if that happens.
I've had issues with memory leaks when creating and removing many Kalendae instances on a single page. Particularly the
mousedown
event handler that is added towindow.document
always leaves a reference to the original object, retaining it in memory until page reload. This patch adds adestroy
method which simply removes these handlers.Also: sometimes
window.getComputedStyle
returns null. I've added a few lines to prevent this from breaking Kalendae by lettinggetStyle
return an empty string if that happens.