guardian/scribe — pull request #288 by craigspaeth (2014-11-04 23:06:48+00:00)
Title: Unbind DOM events on "destroy" event

This isn't merge-ready yet, but I wanted to get the ball rolling on a PR for https://github.com/guardian/scribe/issues/95.

This unbinds DOM events when calling `scribe.destroy()`. I imagine there's more to tear down so I was wondering if anyone might have ideas on what else needs to happen in destroy.

Also this is obviously missing tests. I'm having a little trouble figuring out how to test this as all the other tests seem like high-level integration tests that test the output HTML. It [doesn't seem like I can inspect the attached event handlers](http://stackoverflow.com/questions/2623118/inspect-attached-event-handlers-for-any-dom-element) from the outside, so I'm not sure how to test if these event handlers have been removed. However, I'm happy to dig for a testing solution, just wondered if anyone has insight on this first.