Open Bug 1596974 Opened 6 years ago Updated 5 years ago

Paste As Quotation creates `blockquote` inside `p` (and nested `p`) - invalid HTML

Categories

(Core :: DOM: Editor, defect, P5)

68 Branch
defect

Tracking

()

People

(Reporter: jake, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

Version 60.9.1 (32-bit), Windows 7 x64 - Thunderbird is up to date

  1. Insert the following HTML into a new message:

<p>Hi John,</p>
<p><br>
</p>
<p>I think...</p>

  1. Copy some formatted text (e.g. from another email message) to the clipboard, ideally involving more than one paragraph.

  2. Position the caret in the empty paragraph between "Hi John," and "I think...".

  3. Right-click and select Paste As Quotation.

Actual results:

This is the resulting HTML:

<p>Hi John,</p>
<p>
<blockquote type="cite">First paragraph.
<p>Second paragraph.</p>
</blockquote>
<br>
</p>
<p>I think...</p>

This is invalid HTML. Paragraph elements may only contain phrasing content. The block quotation element is flow content and not allowed inside a paragraph element. Moreover, paragraph elements may not contain other paragraph elements.

Expected results:

The blockquote element should be created outside of any p element, with new p elements created within the pasted blockquote as necessary. In this case, the blockquote should probably be inserted before the p element that the caret was positioned in. If there caret were in the middle of a paragraph, the paragraph should be split (by adding closing and re-opening p tags) with the blockquote inserted at the split (between the closing and re-opening p tags).

In the example given, the resulting HTML should, I think, be as follows:

<p>Hi John,</p>
<blockquote type="cite">
<p>First paragraph.</p>
<p>Second paragraph.</p>
</blockquote>
<p><br>
</p>
<p>I think...</p>

...with the caret positioned in the empty paragraph after the blockquote.

Confirmed. The operation described in comment #0 creates invalid HTML, a blockquote inside a p.

Status: UNCONFIRMED → NEW
Component: Untriaged → DOM: Editor
Ever confirmed: true
Product: Thunderbird → Core
Version: 60 → 68 Branch
Priority: -- → P5
Severity: normal → S4
You need to log in before you can comment on or make changes to this bug.