W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: [css-selectors] Empty input selector

From: Alan Gresley <alan@css-class.com>
Date: Fri, 29 Apr 2011 22:54:34 +1000
Message-ID: <4DBAB50A.7050406@css-class.com>
To: Christoph Pδper <christoph.paeper@crissov.de>
CC: "www-style@w3.org list" <www-style@w3.org>
On 29/04/2011 7:53 PM, Christoph Pδper wrote:
> fantasai:
>> On 04/20/2011 01:00 PM, Rudolph Gottesheim wrote:
>>> input[value=''] { background-color:#f00; }
>>> <input value="" />
>>>
>>> Why doesn't the second input turn red when you enter something?
>>
>> the [value] selector selects on the DOM.
>
>> I'll add it to the list of things to consider for Selectors 4.

[snip]

> By the way, for matching of attribute values we currently have:
>
>     ‘=’ (exact)
>    ‘~=’ (in list)
>    ‘|=’ (exact or starts with followed by dash anything)
>    ‘^=’ (starts with)
>    ‘$=’ (ends with)
>    ‘*=’ (contains)
>
> Although there is ‘:not()’, I think it would be nice to have negated comparisons, i.e. at least
>
>    ‘!=’
>
> but possibly also the rest
>
>    ‘!~=’
>    ‘!|=’
>    ‘!^=’
>    ‘!$=’
>    ‘!*=’
>


Warning, dangerous territory.


What does this match?

   el:not(attr!="value"])


What does this match?

   el:not(attr!*="value"])


Considering these "wildcard" selectors which matches nothing as well as 
everything.

<!DOCTYPE html>

<style type="text/css">
   * {color: white }
   body :not([class$=""]) { background: blue }
   body :not([class*=""]) { background: red }
   body :not([class^=""]) { background: green } /* whatever comes last 
wins */
</style>

<p class="test">"test"</p>
<p class="">""</p>



-- 
Alan Gresley
http://css-3d.org/
http://css-class.com/
Received on Friday, 29 April 2011 12:55:02 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:39 GMT