[wp-trac] [WordPress Trac] #33466: wpautop breaks multi-line textarea content

WordPress Trac noreply at wordpress.org
Sat Aug 22 12:53:08 UTC 2015


#33466: wpautop breaks multi-line textarea content
--------------------------+------------------------
 Reporter:  takayukister  |       Owner:  chriscct7
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.4
Component:  Formatting    |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  wpautop       |     Focuses:
--------------------------+------------------------
Changes (by miqrogroove):

 * keywords:  dev-feedback has-patch wpautop needs-unit-tests => wpautop
 * version:  4.3 =>


Old description:

> Applying wpautop() breaks multi-line content of textarea element because
> it replaces each newline with `<br />`. A textarea can't have HTML in its
> content.
>
> You can reproduce the problem with the following code:
>

> {{{
> $text = '<textarea name="test">Lorem ipsum dolor sit amet,
> consectetur adipisicing elit,
> sed do eiusmod tempor
> incididunt ut labore
> et dolore magna aliqua.</textarea>';
>
> echo wpautop( $text );
> }}}

New description:

 Applying wpautop() breaks multi-line content of textarea element because
 it replaces each newline with `<br />`. A textarea can't have HTML in its
 content.

 You can reproduce the problem with the following code:


 {{{
 $text = '<textarea name="test">
 Lorem ipsum dolor sit amet,
 consectetur adipisicing elit,
 sed do eiusmod tempor
 incididunt ut labore
 et dolore magna aliqua.</textarea>';

 echo wpautop( $text );
 }}}

--

Comment:

 4.3 and 4.2 both failed the attached tests.  I am correcting the ticket,
 including the description to reflect the fact that a newline is required
 after any textarea element.  Omitting the newline causes browsers to strip
 leading whitespace.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33466#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list