[wp-trac] [WordPress Trac] #2833: wpautop breaks style and script tags

WordPress Trac noreply at wordpress.org
Wed Apr 24 15:05:53 UTC 2019


#2833: wpautop breaks style and script tags
--------------------------------------------+-----------------------------
 Reporter:  Nazgul                          |       Owner:  (none)
     Type:  defect (bug)                    |      Status:  reopened
 Priority:  low                             |   Milestone:  Future Release
Component:  Formatting                      |     Version:  2.0.3
 Severity:  normal                          |  Resolution:
 Keywords:  wpautop has-patch dev-feedback  |     Focuses:
--------------------------------------------+-----------------------------

Comment (by aduth):

 Replying to [comment:37 azaozz]:
 > That would mean they will always be "pulled out" on a new line, even
 when inside other tags. That may result in unwanted `<p>` after
 `</script>`. Another option would be to remove leading line breaks before
 `<script...>`. This can still bring edge cases but perhaps less often. Not
 really sure what's the "lesser evil" here :)

 I wonder if rather than treating these as block-level elements (which
 they're not) if it would be preferable then to omit them from this
 [https://github.com/WordPress/wordpress-
 develop/blob/1b9fd43f259f20313f3e6a269d7cbf20a819fca6/src/wp-
 includes/formatting.php#L495 `$allblocks` set] (so as not to trigger this
 [https://github.com/WordPress/wordpress-
 develop/blob/1b9fd43f259f20313f3e6a269d7cbf20a819fca6/src/wp-
 includes/formatting.php#L497-L501 "pull out" newline behavior]), but still
 apply a similar treatment to them in [https://github.com/WordPress
 /wordpress-develop/blob/1b9fd43f259f20313f3e6a269d7cbf20a819fca6/src/wp-
 includes/formatting.php#L561-L562 unwrapping them from `p`] (`$allblocks`
 at this line becomes effectively equivalent to `$allblocks .
 '|script|style'`).

 Could you share an example markup string where you'd expect the described
 issue might occur?

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


More information about the wp-trac mailing list