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 10:34 PM, Cramer, Dave <Dave.Cramer@hbgusa.com> wrote:
> On 10/22/13 1:01 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>>On Tue, Oct 22, 2013 at 10:38 AM, Håkon Wium Lie <howcome@opera.com>
>>wrote:
>>> Likewise, this selector:
>>>
>>>   @page funky:nth(2)
>>>
>>> should give us the second page of every funky page group.
>>>
>>> Thinking of it as pseduo-elements may make it easier to extend into:
>>>
>>>   @page funky:nth(2) p
>>>
>>> Where all p elements inside those pseud-elements are selected.
>>
>>If ::nth() is a pseudo-element, that's fine.  If it's a pseudo-class,
>>it's not fine.  You're free to choose which way it works, but the
>>syntax needs to match up properly - double colons for pseudo-elements.
>>
>>However, I don't think that ::nth() as a pseudo-element works.  You're
>>still styling the page, not some other construct created by the
>>browser.  It's just filtering, like a normal selector, and so is most
>>like a pseudo-class.
>
> css-page defines :first, :left, :right, and :blank as pseudo-classes, even
> though these seem very different from the pseudo-classes defined in
> Selectors 4.

:first, :left, :right, and :blank are all perfectly appropriate
pseudo-classes.  They select pages based on information known the UA,
but not exposed directly.  No problems there.

The problem I was highlighting is that a selector can't interact with
other selectors.  Every simple selector is independent.

>>If some printer implementations have done this wrong, whatever, but
>>don't infect the rest of the platform with inconsistent semantics in
>>their selectors.  If you want the second funky page, use
>>
>>@page :nth-match(2 of funky) { ... }
>
> But we're still facing the original problem, which was (in simplest form)
> to match the first page of each chapter. Prince does:
>
> div.Chapter { page: body; prince-page-group: start; }
> @page body:first { Š } /* or @page body:nth(1) */
>
> And we've heard objections to page-group for being a binary property, and
> for changing the accepted meaning of :first. On the other hand, this
> approach works and has been implemented :)
>
> I wonder if we could avoid the idea of page-group by defining it away.
> This is only an issue for named pages. When a named page is assigned (via
> page: name; ) is there any reason to not start the equivalent of a
> page-group? Then you could write:
>
> div.Chapter { page: body; }
> @page body:tab-approved-pseudo-class-to-be-defined-later(1) { Š } /* would
> match the first page of every div.Chapter */

You've done nothing but shuffle the names around here.  As I just said
to Hakon, if you really want the :nth-of-type() semantics, that's
fine.  But that implies that ":nth(2)" all by itself selects the
second page of *every* group. If that's okay, then fine.

~TJ

Received on Wednesday, 23 October 2013 05:54:17 UTC