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

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 UTC