[whatwg] [WF2] Readonly and default pseudoclass matching

Boris Zbarsky wrote:
> Matthew Raymond wrote:
> 
>>  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.
> 
> Why does :read-only have anything to do with the "readonly" attribute?

   See below.

>>   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].
> 
> Sure.  But later on the actual definition of :read-only makes it clear that it's 
> not limited to just XForms:
> 
>    An element whose contents are not user-alterable is :read-only. However,
>    elements whose contents are user-alterable (such as text input fields) are
>    considered to be in a :read-write state. In typical documents, most elements
>    are :read-only. However it may be possible (e.g. in the context of an editor)
>    for any element to become :read-write.
> 
> Please note last sentence.

Take a look at the following URL:

   http://www.w3.org/TR/2003/REC-xforms-20031014/sliceF.html#id2644859

It describes how XForms controls can be styled. Note the section about
read-only and read-write:

| Selects any form control bound to a node with the model item property
| readonly evaluating to true or false (respectively).

   So, clearly, when :read-only was first introduced for XForms, it was
meant to be used only with form controls that are not only set to
read-only, but are actually capable of being set to read-only in markup.

   What I'm seeing in CSS3-UI is contradictory with respect to the
XForms spec. True, that part of the XForms spec is normative, but it's
clear reference by the section I quoted above, so CSS3-UI is clearly
self-contradictory.

>>   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'm not seeing what gave you that idea.

   The XForms spec clearly states :read-only selects a form control, so
if :read-only is a "way to style elements which are in the respective
states as defined by XForms", then it can't apply to a non-control element.

>>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.
> 
> WF2 is claiming to be doing exactly such clarification, if you note.

   WF2 can suggest how styling should be handled, as XForms did, but it
needs to ultimately be defined by CSS.

>>   That's just it. It's invalid in WF2 to use |readonly| on radio
>>buttons and checkboxes.
> 
> Excuse me?
> 
> <html>
> <style>
>    input[type="checkbox"] { width: 100px; }
>    input[type="checkbox"]:read-only { width: 200px; }
> </style>
> <input type="checkbox" disabled="disabled">
> </html>
> 
> Now, what's invalid here?  What's the width of the checkbox?

   The width of the checkbox is 100 pixels. You should have used the
:disabled pseudo-class from CSS3-UI:

| input[type="checkbox"]:disabled { width: 200px; }

> You seem to be confusing the "readonly" attribute and the :read-only CSS 
> pseudo-class...

   Not at all. See the following URLs:

http://whatwg.org/specs/web-forms/current-work/#readonly
http://www.w3.org/TR/html4/interact/forms.html#adef-readonly

Received on Tuesday, 26 July 2005 17:31:45 UTC