From d8da32a2ed4af2cea9eb6a9a2f19d15bb2d9e755 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 3 Feb 2026 20:08:48 +0000 Subject: [PATCH] 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 --- wp-includes/js/wp-sanitize.js | 2 +- wp-includes/js/wp-sanitize.min.js | 2 +- wp-includes/version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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.