Re: [css3-selectors] Selectors is a Proposed Recommendation

On 12/16/2009 2:52 AM, Daniel Glazman wrote:
> Le 16/12/09 08:59, Patrick Garies a écrit :
>
>> Given that these are edge cases (who uses |[attr$=""]| in real
>> code?)
>
> I saw a lot things like the following:
>
> a[href$=".pdf"]:after { content: " (PDF document)"; }
>
> And I used it myself in another context, storing page-related data in
> a user-defined attribute and triggering styles based both on the
> first 3 chars and the 3 last chars of the attribute value. Very
> handy.

Yeah, but you used the selector with a non-zero length value; that
behavior is clearly defined and not one of the edge cases of which I was
speaking. I meant something literally like |[class$=""]| (with a
zero-length string) which is what Alan appeared to be talking about.
Apparently, that's currently designed to match nothing and Alan wants it
to match "nothing and everything". [1]

As far as I can tell, it doesn't really matter what the behavior is
since the universal selector already matches everything and the vanilla
attribute selector (e.g., |[href=""]| (a document self-reference)) can
already be used to match an attribute that's present but has no value.
If you need more specificity, you can already get that with |!important|
or |:not([foo])|. (Attribute selectors have the same specificity as
pseudo-classes so there's no difference there either.)

[1] <http://lists.w3.org/Archives/Public/www-style/2008Apr/0117.html>

Received on Wednesday, 16 December 2009 09:34:53 UTC