Re: [selectors4] Universal Selector '*' (asterisk) elsewhere

> From: Christoph Päper
> Sent: Thursday, March 29, 2012 1:25 PM
> Subject: Re: [selectors4] Universal Selector '*' (asterisk) elsewhere
>
> François REMY:
>
> > Most of your proposal just doesn't make sense.
>
> It was more a question than a proposal. That’s why I wrote:
>
> >> I haven’t tried to think of use-cases for any of this yet, but 
> >> attribute names and probably values seem like a natural extension, 
> >> because like element names they depend on the document language.


Okay, I did think you were making a formal request to add the feature. Sorry 
for overreacting if it was just a way to open discussion.


> > If you want all elements which have an ID, you should use *[id] but, 
> > seriously, this don't make sense.
> >
You might want to highlight everything you can link to.
>
>   #*::before {content: "#" attr(id); color: red;}


In such cases *[id]::before does the trick.


> > Also, please note that [*=*] matches the same thing as [*], and that 
> > [foo=*] matches the same thing as [foo].
>
>   <bar foo>
>
> Which of the following selectors should match that?
>
>   [foo]
>   [foo=foo]
>   [foo=true]
>   [foo=1]
>   [foo=*]
>   [*=foo]
>
> By SGML rules – XML does not have this – the abbreviated “binary” 
> attribute is actually an unquoted value with optional attribute name 
> (followed by an equals sign) left out, where often it is the same as the 
> value (counter-example: “<table border>” in HTML4). So only the last 
> selector, maybe the second one and thereby the first and third one should 
> work, but most authors would only ever expect and use the first one. 
> Therefore I tend to agree that “[…=*]” would be redundant, because – at 
> least in common markup languages – attributes cannot be set without a 
> value or with an undefined value.

<bar foo> is generally equals to <bar foo="foo"> if you follow the notion of 
binary attribute. That means only [foo=true], [foo=1] should not match the 
markup.

However, I don't think it's defined in CSS anyway. My understanding is that 
it's up to the styled document DOM to define that. An XML document could 
react differently than an HTML document on that basis.

François 

Received on Thursday, 29 March 2012 12:16:27 UTC