Opened 4 years ago
Last modified 3 years ago
#48196 new defect (bug)
The Code Editor generates tag soup with empty paragraphs in td elements
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.2.3 |
Component: | Editor | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
When using the Code Editor with WordPress 5.2.3, the opening <p>
and closing </p>
tags do not appear in the editor and are automatically handled by the editor. If I try to add them to fix things, they are automatically removed. So, now the problem with this automatic handling: The Code Editor generates tag soup with empty paragraphs in td elements. For instance, the generated HTML code looks like this:
<td>text<br /> text</p> <p>text<br /> text</p> <p>text</td>
There are two issues (maybe related). First, this is tag soup. For various reasons (parsing with XML tools, better HTML code understanding and maintenance...), the Code Editor should not omit opening and closing tags. Here, the first </p>
does not have a matching opening tag and the last <p>
does not have a matching closing tag. Moreover, in HTML5 parsing, the first </p>
is parsed as if it were <p></p>
, i.e. an empty paragraph; and the text before it should really be in a paragraph for consistency. If the Code Editor thought that the <td>
implied an opening <p>
just after it, it is wrong! In short, the generated code should be:
<td><p>text<br /> text</p> <p>text<br /> text</p> <p>text</p></td>
Welcome @vinc17.
Could you please provide some steps to follow which shows how to get the editor to generate that invalid markup?
<p>
s are automatically generated by WordPress by design. This can be disabled using thewpautop
filter.https://codex.wordpress.org/Function_Reference/wpautop