Re: [csswg-drafts] [css-text-3] Why is anywhere a value of the line-break property, rather than the word-break property? (#5098)

> In both cases it's about how words get broken,

No, `line-break: anywhere` is not about how words get broken. It does change that, but also influences breaks between words and punctuation, between two punctuation marks, between non-breaking-spaces, and various other situations that don't involve words at all… with `line-break: anywhere`, you allow line breaks anywhere, and words aren't relevant. Other values of line-break fit in that model as well: the line breaks they enable or disable aren't concerned with what's a word, and they affect punctuation marks and various characters or character combination.

`word-break`, on the other hand, is only concerned with what's going on inside words, by changing alphabetic letters (and a few related categories) to behave like ideographs, or vice-versa.

----

> And then you begin to ask yourself, "so which value of word-break should i now be using?"

and 

> It seems to me that anywhere is a natural fit alongside the other word-break values, since it's presumably exclusive to them in usage.

By the nature of what this value does, no matter which of the two properties we attach it do, the other becomes irrelevant. So that on its own isn't a strong argument for which of the two it should be in.

----

> All you wanted to do was stop applying those punctuation rules.

We don't have a value that allows unconditional line breaking around punctuation rules while keeping everything else the same. But if we had one, I suspect it would still be a value of the `line-break` property.

Note that the definition of word-break does say this:
> It does not affect rules governing the soft wrap opportunities created by white space (as well as by other space separators) and around punctuation. (See line-break for controls affecting punctuation and small kana.) 

And then the definition of `break-all` further reinforces the message:
> Note: This value does not affect whether there are soft wrap opportunities around punctuation characters. To allow breaks anywhere, see line-break: anywhere.

----

> […] wasn't immediately clear how line-break:anywhere was different from word-break:break-all,

if you want breaks anywhere on the line, `line-break: anywhere`. If you want to allow break between all letters of a word, `word-break: break-all`.

I'm not saying this to pretend this is self evident. This is just a phrasing that I find convenient to remember what goes where. Line breaking is controlled by a confusing set of properties, and we've been through multiple attempts at redesigning the system, using more or fewer properties, changing which of them controls what, renaming the properties or the values or both… And within the constraints imposed by compatibility, this is the best we've found.

It would be great if everything these properties and values did was entirely obvious based on their name alone. It's probably too late to change that though, and even if it wasn't no better naming scheme has been found yet.

But naming aside, as far as the text of the spec is concerned, the value's description are very explicit about what they do.

-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5098#issuecomment-633431961 using your GitHub account

Received on Monday, 25 May 2020 07:48:30 UTC