W3C home > Mailing lists > Public > www-style@w3.org > March 2012

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 12 Mar 2012 17:54:03 -0500
Message-ID: <4F5E7E8B.6060806@mit.edu>
To: www-style@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:48:51 GMT