[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:26:38 UTC