[whatwg] WebForms2 validity

Anne van Kesteren annevk at opera.com
Fri Feb 9 00:29:11 PST 2007

On Thu, 08 Feb 2007 23:38:34 +0100, Sean Hogan <shogun70 at westnet.com.au>  
> I might be missing something obvious, but...
> When are ValidityState properties updated? And when are CSS  
> pseudo-classes (:valid, :invalid, :in-range, :out-of-range) updated? The  
> spec doesn't say, so I tentatively assume they are meant to always be  
> up-to-date.

They are. The specification should say so much, actually. I think it  
clearly defines when something is valid and when it's not and what the  
objects and pseudo-classes have to reflect...

(You should be able to test this in Opera 9, if you want. It implements  
this stuff.)

> Many textual input form-controls would begin in one or another invalid  
> state (valueMissing, patternMismatch) however authors would typically  
> want CSS validity styles to apply only after checkValidity() - either a  
> manual one or the automatic one performed by form-submission. Of course,  
> one could always dynamically tag form-controls with some appropriate  
> class (e.g. "validated") and hang your styles off that.  
> input[type=text]:invalid.validated { background-color: red; }
> Which wouldn't work when scripting is disabled, but should be  
> sufficient. Anyway, could you clarify this?

Anne van Kesteren

More information about the whatwg mailing list