Open Bug 1789825 Opened 2 years ago Updated 5 months ago

extra empty lines copied to the clipboard from <pre>

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

Firefox 104
defect

Tracking

()

People

(Reporter: lastp, Unassigned)

References

Details

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

Steps to reproduce:

Open this html in Firefox:
<pre id="p"></pre>
<script> p.textContent = "first line\r\nsecond line\r\nthird line\r\n";</script>

Then select all text, copy it to the clipboard and paste it into any text editor.

Actual results:

first line

second line

third line

Expected results:

first line
second line
third line

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Editor' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Editor
Product: Firefox → Core

Confirmed on Linux comparing copy and paste from Firefox and Chrome to gedit.

Carriage returns don't appear in the DOM naturally, so it seems the plain text serializer is bad at dealing with this.

Severity: -- → S4
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: DOM: Editor → DOM: Copy & Paste and Drag & Drop
See Also: → 1915349
You need to log in before you can comment on or make changes to this bug.