Re: [selectors-4] :blank pseudo-class

On 8/19/2015 5:17 PM, fantasai wrote:
> http://www.useragentman.com/blog/2012/11/05/css3-pseudo-classes-and-html5-forms-their-limitations-and-a-possible-solution/
>
> The current :blank pseudo-class should probably be renamed
> and :blank used to indicate blank (omitted) form fields.

I think :empty-or-white-space would be an intuitive substitute for :blank. The name is verbose, but I don't think it matters since this pseudo-class doesn't seem like something that would see frequent use.

I'm not convinced that an empty-or-white-space pseudo-class should exist at all though. Such a pseudo-class would seem to encourage poor coding practices like the one shown in the spec: a paragraph element containing nothing aside from a line-break. Another poor-form construct that I've often seen involves putting non-breaking spaces in elements that could have otherwise been selected via the empty pseudo-class. Some such constructs like <td>&nbsp;</td> do have a use-case that might be worthy of accommodation by CSS, but I think that would be better done by adding a line-height property-based unit so that one can use code like <td/> in tandem with code like td:empty { min-height: 1lh; }.

I don't think blank is a good name for a pseudo-class referring to blank form fields though. I'd propose one of the following alternatives:

  * :blank-text-field, which is more intuitive.
  * :no-value, which adds utility that extends beyond text fields and makes the :indeterminate pseudo-class redundant.
  * :unmodified-by-user, which allows selection of text fields with default values that aren't an empty string and is more useful for elements like the HTML meter and select elements.

Received on Sunday, 23 August 2015 07:53:28 UTC