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

Ian Hickson ian at hixie.ch
Wed Dec 14 17:05:50 PST 2011


On Fri, 13 May 2011, Boris Zbarsky wrote:
>
> http://www.w3.org/TR/html5/rendering.html#punctuation-and-decorations 
> says this:
> 
> "The wbr element is expected to override the 'white-space' property and 
> always provide a line-breaking opportunity."
> 
> Why is this desirable? [...]
>
> In terms of compatibility, WebKit seems to do what the spec says right 
> now, while Trident (IE9), Presto (Opera 11), and Gecko (trunk) don't 
> break on <wbr> in "white-space: nowrap".  So if there are web compat 
> issues, they're more likely to arise with the spec's suggested behavior, 
> I would guess.

On Mon, 16 May 2011, Simon Pieters wrote:
> 
> IE9 seems to wrap in IE5.5 mode and IE7 mode but not IE9 mode.

The original reason was simply compatibility, but not specifically with 
respect to 'white-space' -- it was with respect to <nobr>, which we now 
define in terms of 'white-space'. Specifically, the compatibility need 
that led to the current requirement is that this:

   <nobr>foo<wbr>foo</nobr>

...have a line-breaking opportunity. This is a long-standing bug in Gecko 
filed in 1999 and which I marked WONTFIX back in 2000 (there have been 
several dupes since then, and several other bugs refer to this issue in 
passing based on a quick search I did):

   https://bugzilla.mozilla.org/show_bug.cgi?id=6347

I might be open to changing the current spec text -- presumably to just 
define <wbr> as follows, or something similar (though using U+200B would 
probably affect text selection in a bad way):

   wbr { content: \200B; }
   nobr wbr { white-space: normal; }

It would be good to get implementor feedback on whether this sounds 
feasible, though. I'm reluctant to make big changes in this area without 
knowing how safe it is. This kind of thing can radically affect how pages 
render, especially old pages that aren't being maintained any more.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list