Side navigation
#4004 closed enhancement (fixed)
Opened January 27, 2009 05:02PM UTC
Closed October 03, 2010 01:57AM UTC
Last modified March 15, 2012 03:26PM UTC
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: | |
Blocked by: | Blocking: |
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).
detach() which doesn't remove data is in #6474. Work to use it and use alternative mechanisms is still pending.