Here's an idea for a future level of selectors, which I proposed a
few days ago in

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

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

With this, one could, for example, style inputs that don't have
anything in them:

  input.mandatory[:value=""] { background: red; }

or be used to implement a proposed "placeholder" attribute that
contained text that should be shown until something was entered:

  <input id="search" type="text" placeholder="Search this site">

  input#search[:value=""] {
    content: attr(placeholder); /* assuming 'content' works */;


L. David Baron                       
Mozilla Corporation             

Received on Thursday, 16 October 2008 17:37:31 UTC