W3C home > Mailing lists > Public > www-style@w3.org > September 2010

Re: :invalid

From: Brad Kemper <brad.kemper@gmail.com>
Date: Fri, 24 Sep 2010 07:38:37 -0700
Cc: Ryan Seddon <seddon.ryan@gmail.com>, Mounir Lamouri <mounir.lamouri@gmail.com>, www-style@w3.org
Message-Id: <867FB8BE-0FE6-4144-AE53-25F6073193C2@gmail.com>
To: Jonas Sicking <jonas@sicking.cc>

On Sep 23, 2010, at 10:58 PM, Jonas Sicking wrote:

> 1. Change the way :invalid works such that it is defined to only match
> when we want to *render* invalid UI, not anytime a form control
> doesn't match its constraints.
> 2. Introduce a new pseudo class :invalid-ui which only matches when we
> want to render invalid UI. (For now we'd -moz- prefix it of course)
> Both these solutions are flexible in that it allows us to adjust the
> rules for when we want to render UI without having to introduce
> additional complexity. And both these solutions allow authors to
> easily override the default style and introduce their own.
> The downside with solution 1 is that it affects non-styling uses of
> selectors. Such as the DOM functions querySelector/querySelectorAll.

Can't you just get rid of that downside by letting those selectors automatically match as though they were one of the times when you want to render invalid UI? That is, they would return a list of everything invalid or not yet valid, regardless of whether it has been rendered that way yet?

I'm just imagining the use cases, and thinking that it would be for a button that checks the validity without actually submitting, or perhaps something that writes out a list of everything that is not yet valid (or that is). In those cases you'd want a list of every match, not just the ones those where the style has actually been rendered to indicate it.

In other words, "not yet valid" does match, but you just aren't required to render the pseudo-class until you want to, such as when tabbing out of the field (unlike something like :hover, where you render as soon as it matches).
Received on Friday, 24 September 2010 15:09:58 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:50 UTC