[Bug 13011] Encourage authors to use "white-space: pre-wrap" for contenteditable/designMode

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13011

Aryeh Gregor <Simetrical+w3cbug@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Simetrical+w3cbug@gmail.com

--- Comment #1 from Aryeh Gregor <Simetrical+w3cbug@gmail.com> 2011-06-21 18:09:35 UTC ---
Reasons discussed here:

http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/032187.html

Basically, using "white-space: pre-wrap" on the editable region and on the
non-editable resulting content will make spaces behave much more reasonably and
intuitively.  If you don't, nbsp has to be used for the sake of being
non-collapsing, but also prevents breaking, which causes all sorts of minor
issues.  Wording could be something along the lines of

"Authors are encouraged to set white-space: pre-wrap on editable elements, and
on markup that was originally created in editable elements.  Default HTML
whitespace handling is not well suited to WYSIWYG editing, and line wrapping
will not work correctly in some corner cases if white-space is left at its
default value."

Example of a potential problem without pre-wrap: if the user types "foo  bar",
with two spaces in between, that will become either "foo&nbsp; bar" or "foo
&nbsp;bar".  In the first case, "foo&nbsp;" might wrap to the next line even
though "foo" alone could fit on the current line.  In the second case, if
"&nbsp;bar" starts a line, it will be visibly indented.

If white-space is pre-wrap, then all browsers but IE will not insert nbsp's at
all, just regular spaces, so everything will behave much more sanely.  (But
then you do have to use white-space: pre-wrap when you display the content
later, too.)

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 21 June 2011 18:09:42 UTC