Opened 8 years ago
Last modified 6 years ago
#38656 new defect (bug)
wpautop incorrectly handling paragraphs within block elements
Reported by: | pento | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 5.0 |
Component: | Formatting | Keywords: | has-patch needs-unit-tests needs-testing needs-refresh |
Focuses: | Cc: |
Description
When there are two line breaks within a block element, wpautop()
will replace it with </p><p>
, but the corresponding opening and closing tags won't exist.
For example, <div>a\n\nb</div>
will produce <div>a</p><p>b</div>
, when it really should produce <div>\n<p>a</p>\n<p>b</p>\n</div>
.
Attachments (4)
Change History (8)
#2
@
8 years ago
38656.2.diff makes this all work with nested peeable and unpeeable elements, and adds more unit tests.
#3
@
8 years ago
38656.3.diff adds code comments, and some more complex tests.
There's probably value in adding some intelligence to the closing HTML tag detection, so we can handle some basic invalid HTML. For example, a browser will automatically correct <div><span>foo</div>
, and treat it as <div><span>foo</span></div>
, but wpautop()
will get $peeable
out of sync, causing problems.
#4
@
6 years ago
- Keywords needs-refresh added
- Version set to 5.0
I was able to reproduce this bug on trunk
. 38656.4.diff is a refresh to apply cleanly after coding standards changes.
Running the unit tests using --group 38656
passes, but there is a failure elsewhere in test_that_wpautop_doses_not_add_extra_closing_p_in_figure()
when running --group formatting
.
When testing in the editor, I see the This block contains unexpected or invalid content
message when switching back to visual editor after entering the test markup in the description.
38656.diff is a first pass at fixing this, it needs many more unit tests.