Twipped / Kalendae

A javascript date picker that just works.
MIT License
1.99k stars 285 forks source link

Destroy method for Kalendae.Input which removes all event handlers #94

Closed tedeh closed 11 years ago

tedeh commented 11 years ago

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.

Twipped commented 11 years ago

In the future please work off the dev branch. This was a real pain to merge.

Thanks for the PR.