Make WordPress Core

Opened 5 years ago

Last modified 3 years ago

#14674 new defect (bug)

HR destroys HTML

Reported by: thomask Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.0.1
Component: Formatting Keywords: wpautop has-patch
Focuses: Cc:


if you add <hr /> to the post (via HTML editor, or via enhanced TinyMCE editor) followed by normal text id do not add the <p> for that paragraph, but add the finishing </p>

so it than looks like

<p>some text</p>
<hr>some other text</p>

it can be solved by adding extra line break after <hr> but after reediting the post, the linebreak disapears and must be added again.

Attachments (2)

14674.diff (1.4 KB) - added by solarissmoke 4 years ago.
HR's are a special case of block level element because they self-close
14674.2.diff (960 bytes) - added by solarissmoke 3 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 @dd324 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

@solarissmoke4 years ago

HR's are a special case of block level element because they self-close

comment:2 @solarissmoke4 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

I think the problem was the wpautop was expecting to find a closing tag for the hr element, like it does with all other block-level elements. This patch fixes it for me but needs testing to be sure it doesn't break anything else.

comment:3 @WraithKenny3 years ago

  • Keywords wpautop added

comment:4 @MikeHansenMe3 years ago

  • Keywords needs-refresh needs-patch added; has-patch needs-testing removed

@solarissmoke3 years ago


comment:5 @solarissmoke3 years ago

  • Keywords has-patch added; needs-refresh needs-patch removed

comment:6 @MikeHansenMe3 years ago

  • Keywords close added

not sure why I asked for refresh. This problem seems to be fixed in the current version 3.5-alpha-21751. Proposing we close the ticket.

comment:7 @SergeyBiryukov3 years ago

  • Keywords close removed

I can still reproduce in trunk.

  1. Copy this into Text editor:
    <p>some text</p> <hr />some other text
  2. Preview the post.
  3. View HTML source of the page:
    <p>some text</p>
    <hr />some other text</p>
Note: See TracTickets for help on using tickets.