Bug Tracker

Ticket #3078 (closed bug: invalid)

Opened 6 years ago

Last modified 2 years ago

remove() does not remove associated data

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

Description

Removing a validated form element with $('#myForm').remove() does not free the jQuery.cache of the validator instance. Using this chain, $('#myForm').remove().removeData(), does free the cache, however. Please see the attached code.

Attachments

issue3078.html Download (2.1 KB) - added by jeberma 6 years ago.
a short script that demonstrates the caching issue

Change History

Changed 6 years ago by jeberma

a short script that demonstrates the caching issue

comment:1 Changed 6 years ago by flesler

  • Keywords validate added
  • Owner set to joern
  • Component changed from core to plugin

comment:2 Changed 6 years ago by joern

  • Owner changed from joern to flesler
  • Component changed from plugin to core

Not plugin related. Maybe remove() should also clean up data via removeData().

comment:3 Changed 6 years ago by joern

  • Summary changed from [validate] remove does not uncache validator to remove() does not remove associated data

comment:4 Changed 6 years ago by flesler

The stored data doesn't cause memory leaks per se. Only event handlers. That's the reason it's not cleaned up on remove().

Why should it be removed ? not that this means a big slow down for each removed node (and its descendants).

comment:5 Changed 6 years ago by joern

  • Status changed from new to closed
  • Resolution set to invalid

Considering that the validator instance is stored just in the cache and nowhere else, there isn't a problem the issue of memory leaks. Therefore the overhead of removing data while removing nodes and its descendants isn't worth it.

Please reopen the ticket if you have a scenario where the stale cache actually poses a problem.

Note: See TracTickets for help on using tickets.