[whatwg] Handling of collapsed whitespace in contenteditable

On Mon, Jun 20, 2011 at 5:09 PM, Aryeh Gregor <Simetrical+w3c at gmail.com> wrote:
> Does anyone have any suggestions on how best to handle this? ?It seems
> like no matter what we do, the best advice to authors would be to set
> white-space: pre-wrap on the editable region and the resulting
> editable content. ?So given that, I wish we could make this happen by
> default and avoid all the complexity. ?Failing that, I'll have to work
> out the least damaging way to use nbsp's here, but it's never going to
> behave right in some cases.

I should add, by the way, that the latter seems very hard to get right
without delving further into CSS details than I'd prefer.  I can't
think of any reliable and not-extremely-complicated way to test from
JavaScript whether a space needs to be non-breaking or not in cases
like <b>foo[]</b>bar, for instance.  Indeed, in that case WebKit
produces &nbsp; instead of a regular space.

Received on Monday, 20 June 2011 14:17:38 UTC