Skip to content

Commit 5c5dff2

Browse files
committed
Handle carriage returns
1 parent a945a14 commit 5c5dff2

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
@@ -3776,7 +3776,10 @@ public function set_modifiable_text( string $plaintext_content ): bool {
37763776
* This preserves the intention of adding text with a leading newline which would
37773777
* be removed in HTML.
37783778
*/
3779-
if ( $this->skip_newline_at === $this->text_starts_at && str_starts_with( $plaintext_content, "\n" ) ) {
3779+
if (
3780+
$this->skip_newline_at === $this->text_starts_at &&
3781+
1 === strspn( $plaintext_content, "\n\r", 0, 1 )
3782+
) {
37803783
$plaintext_content = "\n{$plaintext_content}";
37813784
}
37823785

0 commit comments

Comments
 (0)