Bug Tracker

Ticket #3159 (closed bug: fixed)

Opened 6 months ago

Last modified 6 months ago

$(..).empty() leaks memory when form is first child

Reported by: jeberma Assigned to: flesler
Type: bug Priority: major
Milestone: 1.3 Component: core
Version: 1.2.6 Keywords:
Cc: Needs: Commit

Description

Calling $(expr).empty() on an element who's first child is a form fails to uncache/unbind that child's data/events. I think this problem can be attributed to the following method chain:

$.empty -> $.remove -> $.add -> $.makeArray

on line 1135 the filter for array-like parameters should possibly test for form elements, as they also have a length property. It seems like the current implementation creates an array of form fields, excluding the form itself.

Please see the attached file for verification.

Attachments

ticket3159.html (495 bytes) - added by jeberma 6 months ago.
Demonstrates uncaching issue. Run with Firebug enabled.
remove[5788].diff (482 bytes) - added by flesler 6 months ago.
This is the patch

Change History

Changed 6 months ago by jeberma

Demonstrates uncaching issue. Run with Firebug enabled.

Changed 6 months ago by flesler

  • need changed from Review to Patch
  • status changed from new to assigned
  • owner set to flesler

Right, this can be fixed easily.

Changed 6 months ago by flesler

This is the patch

Changed 6 months ago by flesler

  • need changed from Patch to Commit

Changed 6 months ago by flesler

  • status changed from assigned to closed
  • resolution set to fixed

Applied at [5789].

Note: See TracTickets for help on using tickets.