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

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

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Thu, 29 Mar 2012 13:25:49 +0200
Message-Id: <C36C814D-3775-4F3E-8E7B-C0A8F677665A@crissov.de>
To: www-style CSS <www-style@w3.org>
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.


So, like you, I think extending ‘*’ to attribute selectors makes the most sense, if anywhere.

> 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;}

> … *[class]. But, again, this don't make sense.

“.*” might make sense in a complex selector.

> The only useful things I did see in your list are [*] (select any element which has an attribute) and [*=foo] (any element whose an attribute at least has 'foo' as value)

  [**=foo]

would match any element that has one or more attributes, at least one of which has a value that contains the string “foo” once or more often.

  [*=foo]

would match any element that has one or more attributes, at least one of which has a value that equals the string “foo”.

> 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.
Received on Thursday, 29 March 2012 11:26:17 GMT

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