Permalink
Browse files

Widget: Avoid memory leaks when unbinding events with `._off()`

Ref #10056
Ref gh-1319
  • Loading branch information...
scottgonzalez committed Aug 20, 2014
1 parent cedf91c commit b397294d42e783aacd4cc3a52bbe3aacc0f3f725
Showing with 7 additions and 1 deletion.
  1. +7 −1 ui/widget.js
View
@@ -442,8 +442,14 @@ $.Widget.prototype = {
},
_off: function( element, eventName ) {
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
this.eventNamespace;
element.unbind( eventName ).undelegate( eventName );
// Clear the stack to avoid memory leaks (#10056)
this.bindings = $( this.bindings.not( element ).get() );
this.focusable = $( this.focusable.not( element ).get() );
this.hoverable = $( this.hoverable.not( element ).get() );
},
_delay: function( handler, delay ) {

0 comments on commit b397294

Please sign in to comment.