W3C home > Mailing lists > Public > www-style@w3.org > March 2012

:empty matching nodes containing only non-significant whitespace WAS: [css4-text] A non-inherited property to control behavior of whitespace-only child boxes

From: Ojan Vafai <ojan@chromium.org>
Date: Fri, 30 Mar 2012 12:01:56 -0700
Message-ID: <CANMdWTuiU=S5G-u-SRYJPZGcWUWzXH+_oKpxU_Ru=_qEz0=8jg@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: fantasai <fantasai.lists@inkedblade.net>, Aryeh Gregor <ayg@aryeh.name>, Ryosuke Niwa <rniwa@chromium.org>, Ehsan Akhgari <ehsan@mozilla.com>, www-style@w3.org
For the editing use-case below, I'd like :empty to match nodes that contain
only non-significant whitespace. Does anyone know what the use-cases for
:empty as specced are?

If we're concerned about back-compat, we could instead add :collapsed to
explicitly detect the case in question.

On Thu, Mar 29, 2012 at 1:39 PM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Thu, Mar 29, 2012 at 1:34 PM, Ojan Vafai <ojan@chromium.org> wrote:
> > Somewhat off-topic: There's a good use-case here for editing. Right now,
> > HTML editors need to inject dummy content into nodes that are empty or
> > contain only non-significant whitespace. Some UA's use BR elements, some
> use
> > a non-breaking space. In all cases, it causes bugs and make things hard
> on
> > both browser developers and web developers. Could we make :empty match a
> > node that contains only non-significant whitespace and has
> > whitespace-collapse: discard? If so, then editors could do the following
> and
> > avoid any of the complexity of needing dummy content.
> >
> > * {
> >     whitespace-collapse: discard;
> > }
> > :empty:before {
> >     content: '\A0';
> > }
>
> Unfortunately, no.  Selectors cannot depend on properties applied to
> the elements.  It's a layering violation that can produce circularity
> problems.
>
> ~TJ
>
Received on Friday, 30 March 2012 19:02:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:53 GMT