Skip to content

Avoid memory leak with event bindings #1319

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

Closed
wants to merge 3 commits into from

Conversation

scottgonzalez
Copy link
Member

Fixes http://bugs.jqueryui.com/ticket/10056

Original discussion in #1288


The following widgets have refresh() methods:

  • Accordion: Updated to avoid memory leak.
  • Menu: Uses event delegation, has no leak.
  • Selectmenu: Events are on the button, which is constant.
  • Slider: Supports dynamically changing handles, but always unbinds all handle events when rendering new handles.
  • Sortable: Doesn't use ._on(), so has no leak.
  • Tabs: Updated to avoid memory leak.

this.headers = this.element.find( this.options.header )
.addClass( "ui-accordion-header ui-state-default ui-corner-all" );

this.headers.next()
this.panels = this.headers.next()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need to assign this to this.panels? Curious because it wasn't done before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, so that we can get the previous value during a refresh.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I get it now.

@tjvantoll
Copy link
Member

👍

scottgonzalez added a commit that referenced this pull request Aug 21, 2014
scottgonzalez added a commit that referenced this pull request Aug 21, 2014
@scottgonzalez scottgonzalez deleted the event-memory-leak branch October 7, 2014 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants