Ticket #4004 (closed enhancement: fixed)
Speed up DOM removal by decoupling event.remove and removeData
| Reported by: | tr4nslator | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3.2 |
| Component: | core | Version: | 1.3.1 |
| Keywords: | dom remove | Cc: | |
| Blocking: | Blocked by: |
Description
(as discussed here on jQuery dev)
All jQuery operations that remove DOM nodes (including $.fn.replaceWith, $.fn.empty, $.fn.html, and $.fn.text) use $.fn.remove internally to centralize processing for removing events and expando data.
Many of these methods could be made faster by decoupling element death from DOM removal: once elements are killed, they could be replaced using the fastest method: Node.prototype.innerHTML for $.fn.empty, and Node.prototype.replaceChild for $.fn.replaceWith (which is 20% faster than the current method of appending and then removing).
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

detach() which doesn't remove data is in #6474. Work to use it and use alternative mechanisms is still pending.