Re: pseudo-attributes

L. David Baron wrote:
> Here's an idea for a future level of selectors, which I proposed a
> few days ago in
> http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-October/016544.html
> 
> 
> There are some things, like the values of form controls such as text
> inputs, that are rather like attributes (in that they have string
> values), except they're not actually attributes in the markup.  The
> various forms of attribute selectors would all make sense on these
> things.
> 
> The one I'm suggesting here would be a :value pseudo-attribute,
> representing the current value of a text control.  (The value
> attribute in HTML represents the default value, not the current
> value.)
> 
> With this, one could, for example, style inputs that don't have
> anything in them:
> 
>   input.mandatory[:value=""] { background: red; }

In fact the initial value of the input is rarely blank:

   Please insert your family name below:
   +-----------------------------------+
   | Your family name                  |
   +-----------------------------------+

Localizing this would be difficult because you would need a
style rule per localization. Another way to do that could be
a pseudo-class comparing the actual value of the element with
the value of the attribute (or the textual content in some
cases) holding the initial value of the form element.

</Daniel>

Received on Thursday, 16 October 2008 17:57:58 UTC