Closed LukeWage closed 8 years ago
Thanks for contributing, and sorry for the late reply. I agree that unbinding makes sense, but I cannot recall, why exactly I wrote this (very old) code like this:
if( div.addEventListener ) {
div.addEventListener("focus", __focusHandler, true);
div.addEventListener("blur", __focusHandler, true);
} else {
div.onfocusin = div.onfocusout = __focusHandler;
}
Maybe it was because IE6 needed that, or the old jQuery libs didn't work, or simply because I did not know any better. Since Dynatree is feature-frozen I would not want to break compatibility with old requirements: IE 6+, jQuery 1.4+ and jQuery UI 1.7+. @LukeWage: Can you (or anyone else) confirm that your code works there?
Added a destroy method so that events are unbound when the widget is removed from the page. Also changed focus binding so that namespaces are respected to prevent leaking events on rebind/destroy. I am not sure if this is the correct way to handle the focus events but I feel it respected the intent of the original code.