Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#48054 new enhancement

wp.sanitize.stripTags should iterate instead of using recursion

Reported by: jrchamp's profile jrchamp Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.2.3
Component: General Keywords: has-patch needs-testing
Focuses: javascript, performance Cc:


The changes to wp-sanitize.js seemed wasteful and like it produced dead code in the final return.

When I got into it to fix the dead code, I also felt a way about the recursion, because stack and memory exhaustion are two other potential issues. So this way should *at most* be one function call and only duplicate memory instead of being O(n*memory).

This is probably a drive-by commit and for that I apologize. I hope it's more useful than not, but your mileage may vary. Thank you for making WordPress.

Attachments (1)

48054.patch (1.2 KB) - added by sabernhardt 4 years ago.
applying changes to /js/_enqueues/wp/sanitize.js

Download all attachments as: .zip

Change History (3)

4 years ago

applying changes to /js/_enqueues/wp/sanitize.js

#1 @sabernhardt
4 years ago

  • Focuses javascript performance added
  • Keywords needs-testing added

@jrchamp Thanks for the patch!

I simply moved those changes to the file that creates wp-includes/js/wp-sanitize.js.

#2 @jrchamp
4 years ago

Thanks @sabernhardt!

Note: See TracTickets for help on using tickets.