W3C home > Mailing lists > Public > www-style@w3.org > November 2010

Re: [css3-selectors] What's the point of :empty?

From: Ojan Vafai <ojan@chromium.org>
Date: Tue, 2 Nov 2010 08:21:15 -0700
Message-ID: <AANLkTi=N3gGfPsR8c2S=ZLPdJgh60-7_=7c53j+hcGAC@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: Rob Crowther <robertc@boogdesign.com>, www-style@w3.org
On Tue, Nov 2, 2010 at 8:15 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 11/2/10 10:56 AM, Rob Crowther wrote:
>
>> The selector 'div:empty' only selects div one, because all the others
>> end up with an all whitespace text node as a child.
>>
>
> For what it's worth, this is why Gecko has a :-moz-only-whitespace (that we
> mostly use in our quirks-mode stylesheet)....


Another common use-case for this sort of thing is to keep empty block nodes
from collapsing in rich-text editing contexts. As it is now, libraries do
all sorts of hackery to make sure they always have at least a non-breaking
space.  :empty doesn't work for the same reasons, but :-moz-only-whitespace
ought to.

Ojan
Received on Tuesday, 2 November 2010 15:22:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:34 GMT