Bug Tracker

Modify

Ticket #4004 (closed enhancement: fixed)

Opened 4 years ago

Last modified 14 months ago

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

comment:1 Changed 4 years ago by yehuda

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

comment:2 Changed 3 years ago by dmethvin

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

This was done in 1.4 by refactoring into removeData internally.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.