Commit 834d0937a7 for wordpress.org
commit 834d0937a7a6a1ebfbf984c65b4235d2bc4496d5
Author: Weston Ruter <weston@xwp.co>
Date: Tue Feb 3 20:08:48 2026 +0000
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
diff --git a/wp-includes/js/wp-sanitize.js b/wp-includes/js/wp-sanitize.js
index 7b69d65416..515c27ce5a 100644
--- a/wp-includes/js/wp-sanitize.js
+++ b/wp-includes/js/wp-sanitize.js
@@ -23,7 +23,7 @@
* @return {string} Stripped text.
*/
stripTags: function( text ) {
- if ( null === text || 'undefined' === typeof text ) {
+ if ( ! text ) {
return '';
}
diff --git a/wp-includes/js/wp-sanitize.min.js b/wp-includes/js/wp-sanitize.min.js
index c14f69f553..8196c6d385 100644
--- a/wp-includes/js/wp-sanitize.min.js
+++ b/wp-includes/js/wp-sanitize.min.js
@@ -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}};
\ No newline at end of file
+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}};
\ No newline at end of file
diff --git a/wp-includes/version.php b/wp-includes/version.php
index f613ddae61..68067ee4d1 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -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.