andreruffert/rangeslider.js — pull request #109 by satazor (2014-11-20 15:20:07+00:00)
Title: Bug when resizing

Hey!

I've spotted an issue while resizing. When you destroy a rangeslider instance, the resize listeners won't get cleared, originating javascript errors. You can reproduce this error in your demo.

This PR addresses the issue by using the identifier as the namespace instead of the plugin name. Also in the destroy method, we remove ALL the document/window listeners with the identifier namespace to correctly do the events cleanup.

I also wonder why you are using document.body as the element to listen for the start event https://github.com/satazor/rangeslider.js/blob/develop/src/rangeslider.js#L202. Couldn't it be the $range element itself? Did you do that to reduce the actual number of listeners with delegation?