Re: [css-book] Re: [css-page] Meaning of :first page selector (was: [css3-gcpm] Page groups, named pages, and :first)

On Tue, Oct 22, 2013 at 3:46 PM, Håkon Wium Lie <howcome@opera.com> wrote:
> Tab Atkins Jr. wrote:
>
>  > >    @page funky:nth(1) { ... }
>  > >
>  > > selects the first page of the "funky" group
>  > >
>  > > I don't see a need for further syntactic differentiations. Also, this
>  > > has been implemented and used for years.
>  >
>  > That's not how selectors work.  The fact that it's intuitive to act
>  > that way has confused plenty of people over the years, which is why we
>  > introduced the :nth-match() pseudo-class in Selectors 4, so you can
>  > get the intuitive behavior in some manner.
>
> Coming back to this, I guess I don't see how the nth() selectors above
> is fundamentally different from a selector like :nth-of-type().
>
> nth(1) selects the first page in a sequence of "sibling" pages, while
> nth-of-type(1) selects the first element in a sequence of sibling
> elements, no?

:nth-of-type() was an early concession, before we solved the problem
generally with :nth-match().

If you want to give :nth() the same kind of semantics, that's fine.
What you can't do is have one selector rely on another.  Saying that
:nth() selects the nth page in any given set of named pages is fine,
but very likely not what you actually mean.

I suspect, for example, that "@page :nth(2) {...}" is meant to select
the second page only, right?  If so, then yeah, you are *not* using
the :nth-of-type semantics, you're still using the "nth of whatever
the rest of the selector matches" stuff.

If not, then it's fine to do.

~TJ

Received on Wednesday, 23 October 2013 05:51:15 UTC