- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Tue, 22 Oct 2013 11:01:20 -0600
- To: Håkon Wium Lie <howcome@opera.com>
- Cc: Simon Sapin <simon.sapin@exyr.org>, "Cramer, Dave" <Dave.Cramer@hbgusa.com>, "www-style@w3.org" <www-style@w3.org>, MURAKAMI Shinyu <murakami@antenna.co.jp>, Michael Day <mikeday@yeslogic.com>
On Tue, Oct 22, 2013 at 10:38 AM, Håkon Wium Lie <howcome@opera.com> wrote: > Also sprach Tab Atkins Jr.: > > > > To me, it seem quite intuitive that > > > > > > @page :nth(1) { ... } > > > > > > selects the first page and that > > > > > > @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. > > But it's how psedo-elements work. This "selector": > > p:first-line > > selects the first line of every p element (by creating a > pseudo-element etc). That's because pseudo-elements hide a combinator in their syntax. The syntax parallels between pseudo-elements and pseudo-classes has long been a source of confusion for web authors, and occasionally for spec writers. The two really have nothing to do with each other, and it would have been much better had it been an explicit combinator into the "pseudo-children" of the element. > 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. 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) { ... } ~TJ
Received on Tuesday, 22 October 2013 17:02:07 UTC