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

On Thu, Mar 29, 2012 at 2:25 AM, Christoph Päper
<christoph.paeper@crissov.de> wrote:
> 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

For most of these, your variant is more-or-less equivalent to simply
omitting the selector entirely.  The slight difference from simply
omitting doesn't seem like it's of any use.

The one case that seems useful - selecting an element with a
particular attribute, regardless of its value - is already possible by
just putting the attribute name in the selector without a value.


> 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

More confusing, I think, is the fact that all of these variants are
exactly equivalent to omitting it entirely, since they *all* represent
the entire set of integers.  (Or, if the pseudo also involves some
filtering, like :nth-of-type(), they're all exactly equivalent to just
using "n".)


> 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.

Thinking up use-cases should really be the first step of a proposal,
not the last.  ^_^

~TJ

Received on Thursday, 29 March 2012 18:14:42 UTC