Bug 359303 Comment 66 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Mikhail Ryazanov from comment #64)
> (In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Still struggling with the pain, but becoming better) from comment #63)
> 1. Is there any reason to preserve multiple spaces? Formatting with spaces (typewriter-like) is generally a bad idea, since it is not reproducible, and there are more proper ways for indentation and alignment.

Most users don't know:
- whether current editor is HTML editor (`contenteditable` or `designMode) or Text Editor (`<input>` or `<textarea>`).
- how multiple whitespaces are treated in HTML editor (without `<pre>`).

Therefore it makes sense to make typed multiple ASCII whitespaces **look** as-is.

> 2. If preserving them is necessary, doesn't you HTML support the `white-space: pre-wrap` style?

Ideally yes, but all browsers converts whitespaces to NBSPs:
- https://searchfox.org/mozilla-central/rev/3366c3d24f1c3818df37ec0818833bf085e41a53/editor/libeditor/WSRunObject.cpp#376-387
- https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/editing/editing_utilities.cc?l=109-135&rcl=bceef7a94ae50ee87b9753142eab2b669be96552
Therefore, we cannot take another approach anymore from point of view of web-compat.

Therefore, I think that we should keep converting NBSPs in editable elements (`contenteditable` or `designMode`), but I think we shouldn't convert in non-editable elements or `<input>`/`<textarea>` to make users can treat raw data.  So, I think that patch may break something of the former case.
(In reply to Mikhail Ryazanov from comment #64)
> (In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900)(Still struggling with the pain, but becoming better) from comment #63)
> 1. Is there any reason to preserve multiple spaces? Formatting with spaces (typewriter-like) is generally a bad idea, since it is not reproducible, and there are more proper ways for indentation and alignment.

Most users don't know:
- whether current editor is HTML editor (`contenteditable` or `designMode`) or Text Editor (`<input>` or `<textarea>`).
- how multiple whitespaces are treated in HTML editor (without `<pre>`).

Therefore it makes sense to make typed multiple ASCII whitespaces **look** as-is.

> 2. If preserving them is necessary, doesn't you HTML support the `white-space: pre-wrap` style?

Ideally yes, but all browsers converts whitespaces to NBSPs:
- https://searchfox.org/mozilla-central/rev/3366c3d24f1c3818df37ec0818833bf085e41a53/editor/libeditor/WSRunObject.cpp#376-387
- https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/editing/editing_utilities.cc?l=109-135&rcl=bceef7a94ae50ee87b9753142eab2b669be96552
Therefore, we cannot take another approach anymore from point of view of web-compat.

Therefore, I think that we should keep converting NBSPs in editable elements (`contenteditable` or `designMode`), but I think we shouldn't convert in non-editable elements or `<input>`/`<textarea>` to make users can treat raw data.  So, I think that patch may break something of the former case.

Back to Bug 359303 Comment 66