[whatwg] Customize HTML5 forms placeholder style

Boris Zbarsky bzbarsky at MIT.EDU
Sun Feb 21 17:18:44 PST 2010

On 2/21/10 7:11 PM, Dean Edwards wrote:
> Why not just extend :empty to include <input> with no value?

Because that's not backwards-compatible and in fact violates the current 
CSS spec?

> It reads nicely:
> input[required]:empty:after {
> content: "This value is required";
> color: red;
> }

1)  :after is not defined for replaced elements (which <input> is). 
Conforming CSS2.1 user agents do a variety of things here, ranging from 
not rendering such content at all to making it a sibling of the thing 
being styled instead of a child.
2)  input[required]:empty is defined to match any input which has an 
attribute named "required" and no kids in the DOM.  It does NOT match an 
input which has kids in the DOM.

So today, input[required]:empty would match:

   <input required value="This is some value">

in an HTML document and would not match the perfectly doable

   <input required="required" value="This is some value">
     And some random text, too

in an XHTML document.

Unless this is in fact a proposal to completely redefine how :empty 
matching works in some backwards-incompatible way?  Is there evidence 
that this won't break existing consumers?


More information about the whatwg mailing list