Re: [css-selectors] Tagname based substrings

On Wed, 06 Apr 2016 20:18:03 +0200, Marat Tanalin <mtanalin@yandex.ru>  
wrote:

> 05.04.2016, 20:04, "Davis, Greg" <greg.davis@pearson.com>:
>> In my ongoing investigation of web components, I'm finding a place  
>> where I want to target a substring of a tagname to keep the authoring  
>> semantic. That is, when I author my tags like this:
>> <x-navigation />
>> <x-quiz />
>> etc...
>>
>> I want to namespace to them so they have shared attributes like fonts,  
>> etc. I can't find a way in the documentation on attribute substrings,  
>> but might just be missing it. Is there a way to target a tagname? I'm  
>> thinking like this:
>>
>> *[tagname^="x-"] { ... }
>
> This makes sense. The syntax you've provided is already used for  
> attribute selectors, so some functional notation could probably be used  
> instead, e.g.:
>
>     :tag-name(^"x-") {...}

It seems to me this could be equally useful for attributes, in particular  
data-* attributes.

While we're bikeshedding, a more succinct syntax would be IDENT DELIM(*)  
(no allowed whitespace between) so you can do:

     x-admin-* { ... }
     [data-my-*] { ... }

Performance-wise it seems to me this shouldn't be worse than partial  
attribute value selectors, but I could be missing something?

-- 
Simon Pieters
Opera Software

Received on Thursday, 7 April 2016 11:07:06 UTC