Skip to content

Commit 960638b

Browse files
committed
Fix carriage return handling in TEXTAREA
1 parent 053dccf commit 960638b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3894,7 +3894,10 @@ static function ( $tag_match ) {
38943894
* If the intention is to start with a leading newline, ensure that it is preserved
38953895
* by adding an additional leading newline.
38963896
*/
3897-
if ( 'TEXTAREA' === $this->get_tag() && str_starts_with( $plaintext_content, "\n" ) ) {
3897+
if (
3898+
'TEXTAREA' === $this->get_tag() &&
3899+
1 === strspn( $plaintext_content, "\n\r", 0, 1 )
3900+
) {
38983901
$plaintext_content = "\n{$plaintext_content}";
38993902
}
39003903

0 commit comments

Comments
 (0)