- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Wed, 3 Sep 2014 08:48:26 -0700
- To: James Craig <jcraig@apple.com>
- Cc: www-style list <www-style@w3.org>
On Wed, Sep 3, 2014 at 12:27 AM, James Craig <jcraig@apple.com> wrote:
> What's the benefit of this very specific and seemingly limited [att|=val] selector:
>
> [lang|="en"] { /* properties */ }
>
> Over this combination of more extensible selectors?
>
> [lang="en"], [lang^="en-"] { /* properties */ }
>
> If there is no real benefit, should it be dropped from the selectors module? If there is a benefit, please consider adding a note to the draft explaining the benefit.
The only benefit is one of brevity; if you have a longer selector,
you'd have to duplicate the entire thing. As noted, though, |=
predates ^=.
Note as well that you shouldn't be using attribute selectors for the
lang attribute; use the :lang() pseudo-class instead, as it handles
some subtleties of language subtag matching better, and lets you match
multiple languages at once.
~TJ
Received on Wednesday, 3 September 2014 15:49:13 UTC