W3C home > Mailing lists > Public > www-style@w3.org > August 2015

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

From: Brad Kemper <brad.kemper@gmail.com>
Date: Sun, 23 Aug 2015 17:47:05 -0700
Cc: fantasai <fantasai.lists@inkedblade.net>, www-style list <www-style@w3.org>
Message-Id: <829AE911-854E-4A69-B660-DE43147D2581@gmail.com>
To: Patrick Dark <www-style.at.w3.org@patrick.dark.name>

> On Aug 23, 2015, at 12:52 AM, Patrick Dark <www-style.at.w3.org@patrick.dark.name> wrote:
> 
> 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/ <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.

I’m of the opinion that having really long pseudo-classes is not a good idea. It is better to have something that is less burdensome to type and quicker to read, even if is a little abstract. 

While ‘:empty’ is better than nothing, I think that the new property (:empty-or-white-space, or whatever we end up calling it) will replace most reasons for using ‘:empty’ on the Web. That’s my gut feeling, anyway. So we don’t really need to be too explicit in the name for how it is different from the soon-to-be-nearly-obsolete ‘:empty’. Using a word that is a near-synonym would be better than making the pseudo=class several words long. If we can find a short word that conveys “empty of visible content”, or “empty of characters other than those that would normally collapse down to a single space”, that should be what we shoot for.

I’m personally OK with ‘:space”, even if what it matches might contains no space characters or any visible space in the markup. If you think of outer space as the metaphor, where it’s mostly a vacuum, but where there may or may not be a few molecules floating around in any particular region, then I think that is apropos enough. On the other hand, metaphor isn’t as directly applicable as existing terms like ‘white space’, so, I don’t know.
Received on Monday, 24 August 2015 00:47:36 UTC

This archive was generated by hypermail 2.3.1 : Monday, 24 August 2015 00:47:36 UTC