[whatwg] [WF2] Readonly and default pseudoclass matching

Boris Zbarsky wrote:
> I have a question about the description of :read-only in WF2.  The description says:
> 
>    :read-only
>      Matches form control elements that have the readonly attribute set, and to
>      which the readonly attribute applies. (For instance, radio buttons will
>      never match this, regardless of the value of the attribute.)
> 
> It's not clear to me whether this restricts :read-only to _only_ apply to those 
> form controls.

  Seeing as |readonly| is only defined as an attribute for <textarea>,
<input type="text"> and <input type="passwd"> in HTML 4.01, I would
consider WF2 as expanding the use of |readonly|, not restricting it.

> Per my reading of CSS3 UI, for example, :read-only should match
> a random fieldset (since the fieldset itself is not editable in any way).  The 
> text in WF2 could be interpreted this way if one assumes that the whole of 
> section 8.2 only applies to "form controls" (that is, input, output, select, 
> textarea and button), but it's not completely clear what the spec is intending here.

   In the section where :read-only is introduced, it has the following
paragraph:

| Specifically, these new states (except for :default) are provided as a
| way to style elements which are in the respective states as defined by
| XForms [XFORMS10].

   Therefore, unless XForms defines these states for elements other than
form controls, :read-only should not be used for elements like
<fieldset> that don't have a |readonly| attribute. I do agree, though,
the there needs to be clarification in the CSS3-UI spec, but I'm not
sure such clarification belongs in WF2.

> Further, it would make sense to me if a disabled form control matched :readonly 
> (since it _is_ readonly; it doesn't so much matter how it got there, imo).  So 
> for example a disabled radio button would match readonly...

   That's just it. It's invalid in WF2 to use |readonly| on radio
buttons and checkboxes.

> I also have a question about :default.  Again, CSS3 UI makes it pretty clear 
> that :default should match appropriate radio buttons, checkboxes, and options, 
> but WF2 says it only matches the default submit button.  I feel that this 
> contradiction should be somewhat clarified (probably by stating that :default 
> must match said submit button and may match other things as well, per CSS3 UI).

   Hmm. You do have a point here. If someone resets a form, it's
supposed to return to the defaults for all the control values, so for
elements like <option> that allow you to set which elements are selected
by default, those originally selected elements should be stylable via
:default.

Received on Tuesday, 26 July 2005 15:30:09 UTC