Commit f56d172da4 for wordpress.org
commit f56d172da4f5a6defeadc48d96823087442f34ac
Author: Weston Ruter <weston@xwp.co>
Date: Mon Feb 2 18:40:42 2026 +0000
General: Preserve back-compat for `wp.sanitize.stripTags()` to return empty string when passed `null`/`undefined`.
This also bumps the `esversion` to 11 in `tests/qunit/.jshintrc` to match the root `.jshintrc`, following [61544] for #64562.
Follow-up to [61347], [60907].
Props westonruter, jonsurrell, mukesh27, hugod.
See #64274.
Fixes #64574.
Built from https://develop.svn.wordpress.org/trunk@61578
git-svn-id: http://core.svn.wordpress.org/trunk@60889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/js/wp-sanitize.js b/wp-includes/js/wp-sanitize.js
index 4fec26ab30..7b69d65416 100644
--- a/wp-includes/js/wp-sanitize.js
+++ b/wp-includes/js/wp-sanitize.js
@@ -23,6 +23,10 @@
* @return {string} Stripped text.
*/
stripTags: function( text ) {
+ if ( null === text || 'undefined' === typeof text ) {
+ return '';
+ }
+
const domParser = new DOMParser();
const htmlDocument = domParser.parseFromString(
text,
diff --git a/wp-includes/js/wp-sanitize.min.js b/wp-includes/js/wp-sanitize.min.js
index 2c993de0c5..c14f69f553 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){t=(new DOMParser).parseFromString(t,"text/html");return t.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 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
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 4dad369d15..ff2ea8b6d3 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.0-alpha-61577';
+$wp_version = '7.0-alpha-61578';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.