W3C home > Mailing lists > Public > www-style@w3.org > November 2014

Re: [css-gcpm] String-set issues

From: Brad Kemper <brad.kemper@gmail.com>
Date: Tue, 25 Nov 2014 22:01:55 -0800
Message-Id: <562EECE8-83DE-4D44-82C1-9900F4726D1B@gmail.com>
Cc: www-style list <www-style@w3.org>, Dave Cramer <Dave.Cramer@hbgusa.com>
To: Dave Cramer <dauwhe@gmail.com>

> On Nov 25, 2014, at 10:07 AM, Dave Cramer <dauwhe@gmail.com> wrote:
> It bothers me a bit that you have to create two distinct named content
> fragments in order to do this. I think there are some advantages to a
> syntax closer to what string() does today:
> h1 { copy-into: chapter-title }
> @page:left {
>  @top-left {
>    content: copy-from(chapter-title, first);
>    }
> }
> @page:right {
>  @top-right {
>    content: copy-from(chapter-title, last);
>    }
> }

There are, to be sure.

But to me it feels really unnatural to have something that selects a particular element (first, last, etc. on the page) be so so far to the right of where selectors normally exist. It is selecting a class of elements based on their position on the page, similar to what other nth-, first-, and last- pseudo-classes do, so having a pseudo-class that follows that form seems much, much more clear. We can be super clear about what we are selecting if we use, e.g., H1:first-of-page. With 'copy-from(chapter-title, first)' it is much less obvious what the 'first' refers to.

Another thing is I think there is too much of a tendency to go to functional notation in CSS, which is not as easy to read as simple name:value declarations. I really don't want to see functions inside of other functions, and it sounds like functions might really be needed for date and number formatting. So, I'd prefer we avoided functions here for content pulls.

If we did go with functional notation, I think I'd almost prefer to get rid of the indirection altogether, and have a real selector as an argument of the function, like Liam and I touched on. That would make your example look like this:

@page:left {
 @top-left {
   content: copy-from("h1:first-of-page");

@page:right {
 @top-right {
   content: copy-from("h1:first-of-page");

But that could get cumbersome too:

content: "Chapter " copy-from("h1:first-of-page", counter(chapter)) ": " copy-from("h1:first-of-page") "," formatDate(copy-from("h1:first-of-page",attr(date)), "MM/DD/YYYY");

To give you "Chapter 3: CSS Telecon, 11/19/2014"

Although that could be improved to this:

content: "Chapter " copy-from("h1:first-of-page", counter(chapter) ": " contents ", " formatDate(attr(date), "MM/DD/YYYY"));

...where all the counters and attr()s and (element|contents|text) keywords in the second argument refer to the item selected in the first argument. Then you don't need a named flow. But I still prefer the flow model of my first proposal overall. 
Received on Wednesday, 26 November 2014 06:02:25 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:48 UTC