Ticket #3078 (closed bug: invalid)
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
Change History
Changed 5 years ago by jeberma
-
attachment
issue3078.html
added
comment:1 Changed 5 years ago by flesler
- Keywords validate added
- Owner set to joern
- Component changed from core to plugin
comment:2 Changed 5 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 5 years ago by joern
- Summary changed from [validate] remove does not uncache validator to remove() does not remove associated data
comment:4 Changed 5 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 5 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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

a short script that demonstrates the caching issue