[whatwg] Submit controls should be barred from constraint validation in favor of a new pseudo-class

Ian Hickson ian at hixie.ch
Mon May 2 15:44:43 PDT 2011

On Fri, 31 Dec 2010, Mounir Lamouri wrote:
> On 12/31/2010 02:20 AM, Ian Hickson wrote:
> > On Thu, 23 Sep 2010, Mounir Lamouri wrote:
> >>
> >> It sounds like currently the specifications want explicitly to have all 
> >> submit controls being subject for constraint validation [1] which seems 
> >> to be a weird idea. Given that only setCustomValidity() can be used on 
> >> those controls, the only use case I see is to set the submit controls 
> >> invalid when the form is invalid thus having :invalid style applying to 
> >> them.
> >>
> >> If the given use case is correct, I think we should make all submit 
> >> controls barred from constraint validation and introduce a new 
> >> pseudo-class allowing to style submit controls when their form is 
> >> invalid.
> > 
> > Form controls are part of constraint validation for completeness only, as 

I think I meant Submit controls here, not Form controls; my apologies.

> > far as I can tell. Anything that's visible and submitted is a candidate 
> > for constraint validation.
> Except <keygen> and <object>.
> But do we agree that "it's visible and submittable so it should be able
> to be invalid" is not a sane rule? At least, we should not include
> non-editable but visible submittable controls like submit controls.

This only affects people who go out of their way to make submit controls 
invalid, right? I guess I don't really care one way or the other, but it 
seems easier all around to just make things as consistent as possible and 
just allow it.

At the end of the day, on this, I'll spec whatever gets implemented. Do we 
have multiple implementations one way or the other yet?

> >> Current Gecko nightlies (and next beta, beta7) have a 
> >> :-moz-submit-invalid pseudo-class. Submit controls can still be 
> >> marked invalid but that might change before the final release if 
> >> there is an agreement that :-moz-submit-invalid is a better way to 
> >> fulfill the need.
> >>
> >> As a side note for web authors on this list, :-moz-submit-invalid 
> >> currently has a default style on Firefox but that is very likely 
> >> going to change for beta8.
> > 
> > Do people use this feature much?
> It's not in a stable release yet so it's hard to say. Actually, I was 
> wondering if we couldn't introduce the :invalid pseudo-class to the form 
> element. This will remove the need of :-moz-submit-invalid and certainly 
> help for other situations.

As far as pseudo-classes go (and this applies to the :-moz-ui-invalid ones 
too, for that matter), I'm happy to define any pseudo-classes that end up 
in the Selectors spec and any pseudo-classes that multiple browser vendors 
agree to implement, even if the Selectors spec doesn't have them.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list