[wp-trac] [WordPress Trac] #48054: wp.sanitize.stripTags should iterate instead of using recursion
WordPress Trac
noreply at wordpress.org
Mon Oct 6 23:45:04 UTC 2025
#48054: wp.sanitize.stripTags should iterate instead of using recursion
------------------------------------+--------------------------------------
Reporter: jrchamp | Owner: westonruter
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.9
Component: General | Version: 5.2.3
Severity: minor | Resolution: fixed
Keywords: has-patch has-test- | Focuses: javascript, performance
info |
------------------------------------+--------------------------------------
Changes (by westonruter):
* status: accepted => closed
* resolution: => fixed
Comment:
In [changeset:"60907" 60907]:
{{{
#!CommitTicketReference repository="" revision="60907"
General: Optimize `wp.sanitize.stripTags()` to improve memory usage.
This updates the logic to use iteration instead of recursive calls,
resulting in reduced memory usage and avoiding a possible stack overflow
for large HTML documents.
The JS code is also tidied up with improved JSDoc and utilizing `let`
instead of `var`.
Props jrchamp, sabernhardt, SirLouen, rollybueno, mukesh27, flixos90,
westonruter.
Fixes #48054.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48054#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list