Bug Tracker

Opened 15 years ago

Closed 15 years ago

#3159 closed bug (fixed)

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

Reported by: jeberma Owned by: flesler
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

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 (2)

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

Download all attachments as: .zip

Change History (5)

Changed 15 years ago by jeberma

Attachment: ticket3159.html added

Demonstrates uncaching issue. Run with Firebug enabled.

comment:1 Changed 15 years ago by flesler

need: ReviewPatch
Owner: set to flesler
Status: newassigned

Right, this can be fixed easily.

Changed 15 years ago by flesler

Attachment: remove[5788].diff added

This is the patch

comment:2 Changed 15 years ago by flesler

need: PatchCommit

comment:3 Changed 15 years ago by flesler

Resolution: fixed
Status: assignedclosed

Applied at [5789].

Note: See TracTickets for help on using tickets.