[wp-trac] [WordPress Trac] #64274: wp.sanitize.stripTags could rely on the browser for HTML parsing
WordPress Trac
noreply at wordpress.org
Thu Nov 20 04:36:54 UTC 2025
#64274: wp.sanitize.stripTags could rely on the browser for HTML parsing
--------------------------+-----------------------------
Reporter: dmsnell | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: General | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+-----------------------------
Comment (by hbhalodia):
Yeah, it's bit confusing. I guess innerText returns the content that is
usually seen in frontend, so for example if div has display: none; it
would not return innerText from that div, but if we use textContent, it
would return and also preserves the spaces and indentation.
So I am not sure as well what to use here, but Ideally if we do not need
to preserve indentation, spaces we should go with innerText, instead of
textContent but I am open to suggestions.
Cc: @westonruter @dmsnell
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64274#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list