[w3c/clipboard-apis] Replacing no-break spaces when converting HTML to plain text upon clipboard export (Issue #173)

[Gecko bug for context.](https://bugzilla.mozilla.org/show_bug.cgi?id=359303)

It's unclear to me if the operation of generating a plain-text representation of HTML copied to the clipboard is within the scope of this (or any) spec, but in case it is:

It [appears](https://hsivonen.com/test/moz/nbsp.html) that:

* Gecko, WebKit, and Blink retain no-break space characters when exporting HTML as HTML onto the clipboard.
* Gecko, WebKit, and Blink replace no-break space characters with regular spaces when exporting HTML converted to plain text onto the clipboard.
* When exporting plain text as plain text onto the clipboard, WebKit and Blink don't replace no-break spaces with regular spaces, but Gecko does.

The shortest path to have all three do the same thing would be for Gecko to change only not to replace no-break spaces when exporting plain text as plain text.

However, it's bad to replace no-break spaces with regular spaces in HTML to plain text conversion in cases where the no-break spaces are used for a legitimate purpose (e.g. in combination with French quotation marks). At least in Gecko, the replacement of no-break spaces with regular spaces is motivated by undoing the `contentEditable` behavior of generating making every other space bar press insert a no-break space to counteract CSS's space collapsing behavior and producing visible spaces on every space bar press in `contentEditable`.

Questions:

* Would it be bad in practice (as opposed to principle of deviating from the current interop state) to replace no-break space with regular spaces in HTML to plain text conversion only when the `contentEditable`-like pattern of alternating spaces and no-break spaces is detected?
* Is this issue in the scope of this spec or another spec?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/173
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/issues/173@github.com>

Received on Friday, 1 April 2022 13:09:32 UTC