Re: [selectors4] :empty psuedo class and input fields

On 3/12/12 2:59 PM, Stefan Wallin wrote:
> Great points! I would love a dynamic attribute-selector since that also
> would solve the specific use case. But unfortunately I still have
> semantic issues with what :empty means for elements which cannot have
> children.

Just to be pedantic, <input> can in fact have children.  Most obviously 
in XHTML, but also in HTML if scripts get involved:

<style>
   input { color: green; }
   input:empty { color: red; }
</style>
<input value="This text should be green" size="40">
<script>
   document.querySelector("input").
            appendChild(document.createTextNode("Make me nonempty"));
</script>

-Boris

Received on Monday, 12 March 2012 22:54:32 UTC