HTML API: Remove superfluous type-coercing empty() check.

When returning modifiable text in the HTML API, if the text segment
coerces to `false` inside `empty()`, then an empty string has been
returned instead of the string itself. For example, the text node in the
following HTML snippet:

{{{
    <div>0</div>
}}}

In this patch the `empty()` check is removed. The purpose of the original
check was to skip further processing if the text content is empty, but
the check is not needed and the additioanl processing is minimal.
Removing the code removes the defect and leaves a cleaner method in its
absence.

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

Follow-up to [57348]
Follow-up to #60170


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


git-svn-id: http://core.svn.wordpress.org/trunk@57239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-02-28 21:15:12 +00:00
parent 9c91e0e91c
commit 91e7a067a8
2 changed files with 1 additions and 5 deletions

View File

@ -2810,10 +2810,6 @@ class WP_HTML_Tag_Processor {
$decoded = html_entity_decode( $text, ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE );
if ( empty( $decoded ) ) {
return '';
}
/*
* TEXTAREA skips a leading newline, but this newline may appear not only as the
* literal character `\n`, but also as a character reference, such as in the

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-beta3-57737';
$wp_version = '6.5-beta3-57738';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.