- From: Cameron McCormack <cam@mcc.id.au>
- Date: Sun, 19 Aug 2012 10:42:26 +1000
- To: Håkon Wium Lie <howcome@opera.com>
- CC: liam@w3.org, Peter Moulder <peter.moulder@monash.edu>, www-style@w3.org, Michel Onoff <michel.onoff@web.de>
Håkon Wium Lie:
> Hmm. I don't understand why you select children of <a>; <a> has no
> children. Perhaps you meant:
>
> a:target-matches(attr(href url), #figure):target-counter(attr(href url), page, same) {
> content: "on this page";
> }
Yes sorry that's what I meant.
> (In addition to removing the space, I've also removed two commas (to
> align with the new css3-values syntax), and changed the .class into an
> #id selector (to match the sample HTML code))
>
> This would presumably select certain <a> elements, depending on two conditions:
>
> 1) that the <a> element points to the figure
> 2) that the <a> element and its target are laid out on the same page
Yes.
> Intiuitively, I understand (1) and the proposed syntax.
>
> I'm struggling a bit more with (2). You're using the
> "target-counter()" function which, in GCPM, returns a numeric value
> for the 'content' property. Like this:
>
> a::after { content: "(see page " target-counter(attr(href url), page, decimal) ")" }
>
> In your example, though, it's a boolean function, which queries where
> a element appears, right? Perhaps we could find a better name for it.
> E.g.:
>
> :target-placement(attr(href url), page, same)
> :target-layout(attr(href url), page, same)
> :target-place(attr(href url), page, same)
>
> This I could more easily understand.
Yes that looks more understandable, although I thought by having it work
on counter values rather than pages you could use the same mechanism for
having references like "previous section", "next chapter", etc.
> Then we would (e.g.) have:
>
> a:target-matches(attr(href url), #figure):target-layout(attr(href url), page, same) {
> content: "on this page";
> }
>
> or even:
>
> a:target-matches(attr(href url), #figure):target-layout(attr(href url), same, page) {
> content: "on this page";
> }
>
> which reads slightly better.
>
> In most cases, the syntax would be even simpler; (1) isn't really
> needed if the styling is the same for all <a> elements, or a class of
> <a> elements. E.g., we could write:
>
> a:target-layout(attr(href url), same, page) { content: "on this page" }
>
> or:
>
> <a class=desc href="...">..</a>
> a.desc:target-layout(attr(href url), same, page) { content: "on this page" }
>
> Adding the other conditions, we would get:
>
> a:target-layout(attr(href url), same, page) { content: "on this page" }
> a:target-layout(attr(href url), next, page) { content: "on the next page" }
> a:target-layout(attr(href url), previous, page) { content: "on the previous page" }
>
> which even I can read without incurring excessive heachaches.
>
> We could also do:
>
> a:target-layout(attr(href url), same, page) { content: "on this page" }
> a:target-layout(attr(href url), same, spread) { content: "on the opposing page" }
>
> ... if 'same, spread' is defined to only be true if the content is not
> on the same page, but on the other page of the same spread.
>
> Adding columns to the mix also seems natural:
>
> a:target-layout(attr(href url), same, column) { content: "in this column" }
> a:target-layout(attr(href url), next, column) { content: "in the next column" }
> a:target-layout(attr(href url), next, page) { content: "on the next page" }
>
> but we can't easily generate these:
>
> "in the first column on the next page"
> "in column 2 on the next page"
>
> That's probably ok.
"spread" seems good. I'm not sure I've ever seen text that mentions "in
this column", but it shouldn't be harder to support that than pages.
> In conclusion, I think (2) is within scope of GCPM and the proposed
> solution seems reasonable. I'm happy to write it up and add it to the
> editor's draft.
Great!
> I'm less convinced about (1). First, I don't think it's neeeded in
> most cases. Second, if we need it, it probably belongs in a selectors
> draft. Third, selectors within selectors are somewhat scary.
Right, you could get around that by ensuring your <a> elements have a
certain class, if you are happy to change the markup.
Received on Sunday, 19 August 2012 00:42:58 UTC