General: Further preserve back-compat for wp.sanitize.stripTags() to return empty string when falsy value supplied.

Developed in https://github.com/WordPress/wordpress-develop/pull/10856

Follow-up to [61578], [61347], [60907].

Props jonsurrell, hugod, westonruter.
See #64274.
Fixes #64574.

Built from https://develop.svn.wordpress.org/trunk@61585


git-svn-id: http://core.svn.wordpress.org/trunk@60896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter
2026-02-03 20:08:48 +00:00
parent 186815a605
commit d8da32a2ed
3 changed files with 3 additions and 3 deletions

View File

@@ -23,7 +23,7 @@
* @return {string} Stripped text.
*/
stripTags: function( text ) {
if ( null === text || 'undefined' === typeof text ) {
if ( ! text ) {
return '';
}

View File

@@ -1,2 +1,2 @@
/*! This file is auto-generated */
window.wp=window.wp||{},wp.sanitize={stripTags:function(t){return null==t?"":((t=(new DOMParser).parseFromString(t,"text/html")).body.innerText=t.body.innerText,t.body.innerHTML)},stripTagsAndEncodeText:function(t){let e=wp.sanitize.stripTags(t),n=document.createElement("textarea");try{n.textContent=e,e=wp.sanitize.stripTags(n.value)}catch(t){}return e}};
window.wp=window.wp||{},wp.sanitize={stripTags:function(t){return t?((t=(new DOMParser).parseFromString(t,"text/html")).body.innerText=t.body.innerText,t.body.innerHTML):""},stripTagsAndEncodeText:function(t){let e=wp.sanitize.stripTags(t),n=document.createElement("textarea");try{n.textContent=e,e=wp.sanitize.stripTags(n.value)}catch(t){}return e}};

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '7.0-alpha-61584';
$wp_version = '7.0-alpha-61585';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.