Bug 28333 - copying text inside input element to content-editable region adds white-space: pre
Summary: copying text inside input element to content-editable region adds white-space...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-14 17:41 PDT by Ryosuke Niwa
Modified: 2009-08-14 23:32 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2009-08-14 17:41:49 PDT
Copy any text from input element to content-editable region, WebKit adds "white-space: pre" style to the text.

Reproduction steps:
1. Go http://www.mozilla.org/editor/midasdemo/
2. Go HTML source mode, and put <input>
3. Go back to WYSIWYG mode, and type something in the input element.
4. Copy & paste what you typed in the element to outside.
5. "white-space: pre" is added to this text.  Check it on HTML source mode.

This bug causes major websites such as Gmail to include "white-space: pre" in outgoing e-mails.
Comment 1 Ryosuke Niwa 2009-08-14 17:49:36 PDT
I have a feeling that WebKit is explicitly adding white-space: pre to input element.

+ap for her expertise on forms.
Comment 2 Alexey Proskuryakov 2009-08-14 22:12:18 PDT
I do not know anything about this specifically, but without "white-space: pre", multiple spaces would be contracted to one space. Just try "<p>l              l</p>" in an HTML document.

Contenteditable inserts NBSPs to avoid this, but this trick cannot be used with form elements. Perhaps it can be used when serializing content for pasteboard, but to start considering this, it would help to know why the current behavior is a problem.
Comment 3 Alexey Proskuryakov 2009-08-14 22:13:23 PDT
(In reply to comment #2)
> Just try "<p>l             
> l</p>" in an HTML document.

That was meant to be "l", many spaces, "l".
Comment 4 Ryosuke Niwa 2009-08-14 22:58:13 PDT
(In reply to comment #2)
> I do not know anything about this specifically

Sorry wrong username.  I meant to add Adele.  +adele & -ap.  Sorry about the confusion.