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

On 8/23/2015 7:47 PM, Brad Kemper wrote:
>
>> On Aug 23, 2015, at 12:52 AM, Patrick Dark <www-style.at.w3.org@patrick.dark.name <mailto: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/
>>>
>>> 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 think I'm leaning toward a conclusion that this pseudo-class is unnecessary (which would make naming a moot point). The single use-case presented in the spec isn't something that should be encouraged, and your replacement hypothesis gives me the impression that the :blankproposal is just a less restricted form of :empty meant to accommodate poor code where :emptywould otherwise work. Or perhaps this pseudo-class proposal is meant to standardize the corresponding Mozilla property (mentioned in the spec) which itself isn't justified.

> 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.

The term "space" isn't consistent with the existing white-space property though, and even with a name like white-space, the terminology doesn't make sense because the proposed pseudo-class will select empty, replaced elements—often with visual output and without a DOM tree containing white space—as well as elements that aren't drawn at all—many empty elements and replaced elements like audio.

If this proposal must go forward despite the above, :no-contentseems like a decent alternative to :empty-or-white-space since white space is arguably not content. The name would make more sense though if the pseudo-class was redesigned to exclude replaced elements. It doesn't make a whole lot of sense to have a pseudo-class with a name reflecting nothingness or space select an element like img, for example, when clearly there is something there and there isn't necessarily any white space.

Received on Monday, 24 August 2015 02:30:16 UTC