[whatwg] Interaction of <wbr> and CSS white-space

On 05/16/2011 06:50 AM, Boris Zbarsky wrote:
>
> another would be adding a new text-wrap value that means exactly that, leaving it
> up to the markup language to identify the allowed breakpoints.

I would prefer not to do this, if it's not necessary.

>> When I wish to say that characters like the hyphen "-" and
>> the percent sign "%" are not to be treated as breakpoints, as browsers
>> may treat them by default, what can I do?
>
> Nothing at the moment, but that seems like something to specify via CSS text-wrap, not via markup.

Actually something to consider for 'line-break: strict', maybe.
Jukka, can you post to www-style about your considerations on
that point? It's rather off-topic here. (Add [css3-text] to the
subject.)

>> No, because browsers treat a large number of non-whitespace characters
>> as allowing line breaks after them. Authors need something to prevent
>> ridiculous and distorting line breaks in, say, "-1", "%5", and "f(1)".
>
> OK. I think that something belongs in CSS (or, going out on a limb,
> should just be considered a quality-of-implementation issue). This
> is not an HTML-specific problem.

CSS3 Text does recommend doing some kind of prioritization when allowing
breaks at punctuation other than spaces, so it is both a CSS issue and
a quality-of-implementation issue. :)
   http://www.w3.org/TR/css3-text/#text-wrap

> Another thing to ponder: I accept that <wbr> inside <nobr> should allow
> breaking. Should <wbr> inside <pre> allow breaking?

That's an interesting one. I'd have to test like Netscape 4 to find out.

If <wbr> doesn't break in <pre>, then it seems the rule we want is either
   wbr { content: '\8203' /* zwsp */ }
   nobr wbr { text-wrap: normal; }
or
   wbr { content: '\8203' /* zwsp */; text-wrap: normal; }
   pre wbr { content: none; }

I'm leaning somewhat towards the second option.

~fantasai

Received on Monday, 16 May 2011 14:26:45 UTC