-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Avoid memory leaks during refresh - DO NOT MERGE #1288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,8 +435,13 @@ $.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 ); | ||
|
||
this.bindings = $( this.bindings.not( element ).get() ); | ||
this.focusable = $( this.focusable.not( element ).get() ); | ||
this.hoverable = $( this.hoverable.not( element ).get() ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm generating new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For 1.12/2.2 we could add a method to clear off the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we'll continue to be limited to just a handful of these uses (likely just this one place for all of UI), so it's probably not worth adding a new method for it. This should be a pretty fast operation as is, especially with how few objects we're working with. |
||
}, | ||
|
||
_delay: function( handler, delay ) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually shouldn't be too hard to manage, since we're already tracking the elements in each widget. We can either have a conditional like this or initialize all the properties to empty jQuery objects to avoid calling
.not()
onundefined
. We'll just need to go through every widget and make sure we're doing this.