Opened 14 years ago
Last modified 6 years ago
#15006 reopened defect (bug)
Closing tag for empty <p> tag is removed
Reported by: | miqrogroove | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.0 |
Component: | Formatting | Keywords: | wpautop needs-patch |
Focuses: | Cc: |
Description (last modified by )
I have a page post that starts like this:
<p style="text-align: right;">Text Here</p> <p style="text-align: right;"></p> More Text Here
The HTML source saves correctly, but the page output omits the closing tag for the second P element, causing the rest of the page to be invalid.
If you have any trouble reproducing this I will be happy to debug it on my server.
Attachments (2)
Change History (19)
#4
@
14 years ago
Unsurprisingly perhaps, when I activated PHP Markdown (which automatically disables wpautop and does its own autoparagraphing) the problem disappeared.
#5
@
14 years ago
Why do you need an empty <p> tag anyway?
This ticket is about invalid output. If there's a problem in the html editor you should make a separate ticket for that.
#7
@
14 years ago
- Keywords wpautop needs-patch added
- Milestone changed from Awaiting Review to Future Release
#8
@
11 years ago
- Keywords wpautop needs-patch removed
- Resolution set to worksforme
- Status changed from new to closed
Tested in 3.6.
#9
@
11 years ago
- Keywords needs-patch wpautop added
- Resolution worksforme deleted
- Status changed from closed to reopened
Apologies, this is still a problem in 3.6.
#12
@
11 years ago
In Trunk at r25093 The closing tag for the 2nd p element is not stripped.
<p style="text-align: right;">Text Here</p> <p style="text-align: right;"> </p><p>More Text Here</p>
If I switch to visual editor the 2nd p element gets removed.
<p style="text-align: right;">Text Here</p> <p>More Text Here</p>
#13
@
11 years ago
- Keywords needs-unit-tests added
- Milestone changed from Awaiting Review to Future Release
- Summary changed from Invalid Content Markup to Closing tag for empty <p> tag is removed
Let's get a unit test here. Is this still reproducible in trunk, given TinyMCE 4.0? Is this particular to wpautop(), to JS's wpautop, to TinyMCE, what?
#14
@
10 years ago
- Keywords has-patch added; needs-patch removed
Confirmed that this is still happening in trunk and is due to wpautop(). Used the following as a quick test:
<p style="text-align: right;">Some Text</p> <p style="text-align: right;"></p> <p>Moar text</p> <p></p> <p class="some-class">Some text <a href="#something">with an anchor</a> and some more text</p> <p>No attr, but a nested <a href="#">here</a></p> <p>Let's try an empty nested tag: <a href="#test"></a></p>
Attaching a patch that updates the regex near line 424 to handle <p> tags that have attributes such as the text-align mentioned above. This left some orphan </p> tags, and balanceTags() looks like it handled that issue, although this probably needs to be tested a bit more thoroughly. With the content above, the empty <p> tags are completely removed, other tags are left as expected.
That said, this may also be a wontfix issue - in HTML5 it is perfectly valid to have <p> tags without a matching closing tag.
#15
@
10 years ago
I written a unit test in 15006-unit_test.patch which shows that 15006.diff causes more issues than it solves. That patch causes two additional unit tests to fail.
The workaround I am currently using:
Putting any text in the second paragraph somehow fixes the problem.