[wp-trac] [WordPress Trac] #27034: jQuery methods html('') vs empty()
WordPress Trac
noreply at wordpress.org
Thu Feb 6 08:38:57 UTC 2014
#27034: jQuery methods html('') vs empty()
-------------------------------------+-----------------------------
Reporter: madeinua | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Appearance | Version: 3.8.1
Severity: normal | Keywords:
Focuses: javascript, performance |
-------------------------------------+-----------------------------
I found that in a many places in WP uses .html('') instead of .empty()
There is a few advantages to use the second one:
1. $.empty() works faster
2. $.html('') creates memory leak
3. $.empty() is more readable
Confirmation of these words you can find on the internet (e.g.
stackoverflow).
Thanks!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27034>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list