Re: [css3-gcpm] No need to call out attr() in bookmark-label and bookmark-target

On Mon, Nov 14, 2011 at 4:16 PM, Håkon Wium Lie <howcome@opera.com> wrote:
> Tab wrote:
>
>  > In the definitions for 'bookmark-label' and 'bookmark-target', the
>  > property definition line explicitly talks about the attr() function.
>  > There's no need to do so - attr() resolves to a particular type based
>  > on its type argument.
>
> Right, we no longer need to do what CSS 2.1 does -- e.g., here:
>
>  http://www.w3.org/TR/CSS2/generate.html#propdef-content
>
> A relief.

Oof, yeah.  We should be able to just drop <counter> and <attr> from
that line when we pull that into a level 3 module.


>  > So bookmark-label, for example, only needs to
>  > say that it accepts <string>, and then any use of "attr(foo as
>  > string)" or "attr(foo)" will be valid, but "attr(foo as color)" won't
>  > be.  A similar consideration applies for bookmark-target and the <url>
>  > type.
>
> I can see that the cue-based approach to functional arguments make
> some sense; replacing "," with " as " could possible make things more
> readable. Taking the type out of the parethesis may be even better:
>
>    bookmark-label: attr(title) as string
>
> I'm not sure it scales, though. Consider this example, which people
> have been writing for some years:
>
>    a::after { content: "(see page " target-counter(attr(href, url), page, decimal) ")" }
>
> which could become:
>
>    a::after { content: "(see page " target-counter(attr(href as url) of page as decimal) ")" }
>
> or perhaps:
>
>    a::after { content: "(see page " target-counter(attr(href) as url, of (page) as decimal) ")" }
>
> It suddenly doesn't look as good anymore. Hmm.

I don't think we should pull arguments out of the function entirely.
I'm not sure it's intuitive (it looks like a generic modifier that can
be added to other things), and there's always a chance of ambiguity in
complex grammars.

However, the second form ("attr(href as url)") looks just fine to me.

~TJ

Received on Tuesday, 15 November 2011 00:26:42 UTC