[whatwg] Idea: pseudo-classes :valid and :invalid for whole form?

Boris Zbarsky bzbarsky at MIT.EDU
Wed Jun 15 12:35:37 PDT 2011


On 6/15/11 3:12 PM, Eduard Pascual wrote:
> 2011/6/15 Boris Zbarsky<bzbarsky at mit.edu>:
>> No, it wouldn't.  The point here is to style based on a _form_ that is
>> invalid.  Whether a form is valid or not is up to the language defining
>> forms, that being HTML.
>
> Sorry, I assumed the simple definition that a form is invalid if it
> contains invalid input elements

A form need not contain its controls.  Consider this HTML document:

   <!DOCTYPE html>
   <form id="myform" action="something">
     <input type="submit">
   </form>
   <input type="number" value="abracadabra" form="myform">

How would you select the form based on the valid/invalid state of the 
number input?

> and there are proposals on the wiki
> to deal with selecting an element based on its children.

Not good enough; see above.

-Boris



More information about the whatwg mailing list