[whatwg] [WF2] Readonly and default pseudoclass matching

Boris Zbarsky bzbarsky at mit.edu
Tue Jul 26 15:41:06 PDT 2005


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?  There's 
no reason it should.  Again, I think that, say, a random <div> in an HTML 
document is :read-only, unless the document is editable (in which case it's 
:read-write).

>    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.

>    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.

> 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.

>    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?

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

-Boris



More information about the whatwg mailing list