Re: [css-gcpm] String-set issues

On Nov 25, 2014, at 10:07 AM, Dave Cramer <dauwhe@gmail.com> wrote:

>> So basically, it is the same as "flow-into", except that it does not remove
>> anything, just a copy, and it has some other choices besides just "content"
>> and "element" (I would also change "content" to "contents" in Regions).
>> Plus, it can list several different names to copy stuff into, e.g. like
>> this: 'copy-into: myContents contents, chapNum counter(chapter)'. And it has
>> 'contents' as the default if one of the other levels is not specified
>> instead.
> 
> I'm not sure I fully understand this bit:
> 
> h1 { copy-into: myContents contents, chapNum counter(chapter) }
> 
> What's the advantage of assigning the counter to a named content
> fragment here? That's something that's not related to the element.
> 
> @top-center { content 'Chapter' chapNum ': ' myContents }
> 
> could be written as
> 
> @top-center { content 'Chapter' counter(chapter) ': ' myContents }
> 
> I think it might be conceptually simpler to use copy-into solely to
> get the content of the element, given that the content property
> already gives us access to counters, attributes, and literal text.

Imagine you have this:

H1 { counter-increment: chapter }

...and there are 3 H1's on the page. 

I don't know when @top-center grabs counter values, but let's say it is right after everything on the page that increments counters has already done so. If that's the case, in your example,  the value of 'chapter' would have been incremented by the third H1. But maybe what you want is the chapter count and text from the first H1. In that case, you would write this:

h1:first-on-page {
    copy-into: myContents contents, 
            chapNum counter(chapter) 
}

...and keep the @top-center as I had it. 

Is that clear? It is to get the counter value as it is for the particular element you want, before it gets incremented to something else. 

Received on Tuesday, 25 November 2014 18:44:16 UTC