W3C home > Mailing lists > Public > www-style@w3.org > October 2008

Re: pseudo-attributes

From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Date: Thu, 16 Oct 2008 19:57:21 +0200
Message-ID: <48F78081.1090709@disruptive-innovations.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: www-style@w3.org

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.

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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:40 UTC