WordPress.org

Make WordPress Core

Opened 3 weeks ago

#48196 new defect (bug)

The Code Editor generates tag soup with empty paragraphs in td elements

Reported by: vinc17 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2.3
Component: Editor Keywords:
Focuses: Cc:
PR Number:

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>

Change History (0)

Note: See TracTickets for help on using tickets.