Re: [selectors] Is ::pseudo-element:empty valid?

On Tue, Nov 25, 2014 at 6:44 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
>> On Nov 24, 2014, at 1:15 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> :empty either *always* matches ::before pseudos, or isn't applicable
>> to them at all (depending on some unstated additional requirements in
>> the spec that really need to be written down*).  It's not actually
>> useful for anything.
>
> ::before doesn't exist unless it has content, so your second statement seems more true. Except that an empty string as content does bring it into existence, and that should match :empty, I would think.
>
> But not generally useful. Once you insert an image into it, it is not empty, even if the image hasn't loaded.

:empty is based on DOM content, which ::before doesn't have any of, so
that's why it's either always true (because ::before has no DOM
contents) or isn't applicable/is always false (because ::before isn't
a DOM element either).

The 'content' property obviously can't have any effect on whether
:empty matches, for circularity reasons, but also because :empty's
definition doesn't mention it.

~TJ

Received on Tuesday, 25 November 2014 20:57:31 UTC