[whatwg] Web Forms 2 stable draft draft

Olav Junker Kjær olav at olav.dk
Mon Feb 7 09:50:07 PST 2005


You write:
 > The model used by the validity  DOM attribute is not very clean, and
 > may deserve to be replaced with something that has been thought
 > through with more care

Perhaps the bit field interface could be left out. The only thing that 
can't be done through the properties, is easily checking if the field is 
valid or not, like:
   if (field1.validity) ...
This could be supported by having the validity attribute return null 
when the field is valid. The ValidityState object would then alway be 
the description of an error.
This may be a bad idea though, since code like:

   if (field1.validity.isPatternMismatch) ...

would generate an error when the field is valid.
A better solution would perhaps be to add an attribute, "isValid" to 
ValidationState. So you could write:

  if (field1.validity.isValid) ...

Only problem is that the naming seems a bit strange. "validityState" 
would be clearer than "validity", but also a bit more cumbersome.

Anyway, it seems a bit redundant to support both the bit field and 
property interfaces.

regards
Olav Junker Kjær



More information about the whatwg mailing list