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

Re: [selectors4] :empty psuedo class and input fields

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Mon, 12 Mar 2012 19:42:31 +0100
Message-Id: <753AE827-9CE5-4EA2-95B6-2C4C6343009C@crissov.de>
To: "www-style@w3.org Style" <www-style@w3.org>
Stefan Wallin:
> 
> My issue. I think the :empty pseudo class selector is not super intuitive when it comes to form elements such as input fields. 

Your issue, actually, is not with the ‘:empty’ pseudo-class. You want a dynamic selector for the value (attribute). David Baron suggested a pseudo-attribute, ‘[:value]’, for this <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-October/016544.html>. The CSS WG wiki <http://wiki.csswg.org/spec/selectors4> currently lists the ‘::value’ pseudo-element from the UI module <http://dev.w3.org/csswg/css3-ui/#pseudo-value> as an alternative, but that’s wrong I think, because you cannot do attribute value comparison (‘=’, ‘^=’, ‘$=’, ‘*=’ …) with that.

> input:empty always marks as true, regardless if the value attribute is empty or not.

Of course, because the element is empty. The attribute doesn’t matter at all.

> input[value=""] only detects initial status and not changes to the element later on in the page lifetime.

Like I said.
Received on Monday, 12 March 2012 18:43:02 GMT

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