pascalduez / postcss-quantity-queries

PostCSS plugin enabling quantity-queries
The Unlicense
114 stars 4 forks source link

Feature Request - of type #12

Closed mabar closed 5 years ago

mabar commented 8 years ago

Can you add selectors for *-of-type? They are usually working more as expected than child selectors. Described on css-tricks.com Something simple like :exactly-of-type would be good.

mabar commented 7 years ago

ping @pascalduez

pascalduez commented 7 years ago

Hi,

could you describe a bit more the use-cases and give a few examples? I'm not having a clear picture about how this could be related to quantities.

mabar commented 7 years ago
<p>Foo</p>
<p>Bar</p>

For this code work both

But when you add one element

<h1>Foo</h1>
<p>Bar</p>
<p>Baz</p>

With this code :nth-child selects first paragraph, :nth-of-type still selects second. Add one tag before paragraphs and :nth-child selects nothing.

I am using quantities in design where I sometimes need to add some spans when pseudo elements are insufficient and child selectors are breaking that.

pascalduez commented 7 years ago

I see what you mean now.

So out of the blue this would give something like:

:at-least-of-type(count) { ... }
:at-most-of-type(count) { … }
:between-of-type(start, end) { … }
:exactly-of-type(count) { … }

Won't be implemented before the WIP refactor for #8 is done.