- From: fantasai <fantasai.lists@inkedblade.net>
- Date: Sun, 07 Sep 2014 09:29:54 -0400
- To: "Tab Atkins Jr." <jackalmage@gmail.com>, James Craig <jcraig@apple.com>
- CC: www-style list <www-style@w3.org>
On 09/03/2014 11:48 AM, Tab Atkins Jr. wrote:
> 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.
:lang() also handles inheritance of the lang attribute.
In some cases this is not what you want, you actually want the element
with the lang attribute, in which case [lang|=] is better, or you can
use [lang]:lang(...) to get the full effect of L4 :lang() matching.
~fantasai
Received on Sunday, 7 September 2014 13:30:25 UTC