Skip to content

Commit faf0ed0

Browse files
committed
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 #6199 Follow-up to [57348] Follow-up to #60170 git-svn-id: https://develop.svn.wordpress.org/trunk@57738 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9da33ad commit faf0ed0

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

src/wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,10 +2810,6 @@ public function get_modifiable_text() {
28102810

28112811
$decoded = html_entity_decode( $text, ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE );
28122812

2813-
if ( empty( $decoded ) ) {
2814-
return '';
2815-
}
2816-
28172813
/*
28182814
* TEXTAREA skips a leading newline, but this newline may appear not only as the
28192815
* literal character `\n`, but also as a character reference, such as in the

0 commit comments

Comments
 (0)