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

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

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Thu, 29 Mar 2012 11:56:44 +0200
Message-ID: <925235C0C1B347AAA5171F2347FA9F12@FREMYD2>
To: Christoph Päper <christoph.paeper@crissov.de>, "www-style CSS" <www-style@w3.org>
Most of your proposal just doesn't make sense.

Each pseudoclass has a different meaning, how can you say "I just want one 
of them"? Seriously, why would you apply the same styling for a :hover 
element, a :invalid and a :valid element ? Matching any parametric 
pseudoclass is also pure non-sense. :*(xxx) would match 
:any(:matches(xxx),:not(xxx)) which mean all elements.

Similary, selecting an element by ID has the purpose of making it unique. If 
you want all elements which have an ID, you should use *[id] but, seriously, 
this don't make sense. The same apply for classes. If you want all elements 
which have a class defined, use *[class]. But, again, this don't make sense.

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) even if I never had to use them.

Also, please note that [*=*] matches the same thing as [*], and that [foo=*] 
matches the same thing as [foo].

Regards,
François





-----Message d'origine----- 
From: Christoph Päper
Sent: Thursday, March 29, 2012 11:25 AM
To: www-style CSS
Subject: [selectors4] Universal Selector '*' (asterisk) elsewhere

The character ‘*’ can be used as a wildcard – meaning “any but not none” – 
for element names and namespaces. Level 4 also clarifies that it can be used 
with language (sub)tags in ‘lang()’. Should the asterisk be meaningful in 
other places, too?

  #*            – any ID
  .*            – any class
  ::*           – any pseudo-element
  :*            – any pseudo-class
  :*()          – any parametric pseudo-class
  :*(*)         – any parametric pseudo-class with any value
  :*(foo)       – any parametric pseudo-class with a certain value
  :foo(*)       – any value for a certain parametric pseudo-class
  [*]           – any attribute
  [*=*]         – any attribute with any value
  [*=foo]       – any attribute with a certain value
  [foo=*]       – any value for a certain attribute

Note that

  [foo*=bar]    – a certain attribute containing a certain string at least 
once in its value

already has defined semantics. The asterisk is already meaningful in 
parametric pseudo-classes that expect a selector as an argument. Also 
consider that some parametric pseudo-classes accept math-like arguments, 
i.e. “An+B”, where the asterisk may look like a multiplication sign and 
thereby be confusing:

  :foo(*n)      – any A
  :foo(*)       – any B
  :foo(+*)      – any B
  :foo(-*)      – any B
  :foo(*n+*)    – any A and any B

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. I wonder whether these 
should be equivalent:

  :foo
  :foo(*)
or
  :foo
  :foo()
or
  :foo()
  :foo(*)

  :*(foo)
  :(foo)

  E[*]
  E[*=*]

  E[foo]
  E[foo=*]

I assume the following are equivalent already, although not explicitly 
mentioned:

  E
  E[] 
Received on Thursday, 29 March 2012 09:57:18 GMT

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