Open Bug 1049785 Opened 9 years ago Updated 2 years ago

Paste in contentEditable div from xclip removes newlines


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

31 Branch





(Reporter: mocramis, Unassigned)


User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release)
Build ID: 20140722064054

Steps to reproduce:

1) In a terminal enter
echo "Hello \!\nDo you know you are a pretty dinausaur ?" | xclip -i -selection clipboard

2)Paste the text (ctrl + V) in a editable div (with the flag contentEditable="true"). (You can use as an example and see it works  fine in textarea).

Actual results:

The resulting text was:
Hello ! Do you know you are a pretty dinausaur ? 

Expected results:

The expected text was what happen in a textarea:
Hello !
Do you know you are a pretty dinausaur ?
So far i can only reproduce the problem using xclip.

Pastes from applications like vim or firefox are fine.

Chronium handles the pasted text correctly.

I also tried with todays nightly and reproduced the problem (don't have the exact version number now i'll add it tomorrow).
Component: Untriaged → General
Do you now if this ever worked by checking old Firefox (like back to 3.x) Rels?
Component: General → Editor
Product: Firefox → Core
I do not have any other version to test it but i do not recall a version in which it did work.

btw the nightly version is 34.0a1 (2014-08-04)
Reproduced on Ubuntu 14.04 AMD64, Firefox 39, xorg 1:7.7+1ubuntu8 xsel 1.2.

In particular, this breaks pastes into gmail as reported at:!msg/gmail/aV8bdPFiR24/3Owwd9rSaD0J

Also if I paste on a textarea, then paste into the contenteditable, it works as expected, even though `xclip -selection clipboard -o | hd` says the bytes are the same. Hmmm
I meant: paste on a textarea, then copy from the textarea and paste into the contenteditable
Also, it works with xsel, but fails for xclip.

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority and severity.

If you have reason to believe this is wrong, please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.