W3C home > Mailing lists > Public > www-style@w3.org > October 2013

Re: Referring to elements from CSS. (In, but not limited to [css-images-4] and [css-gcpm])

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 1 Oct 2013 15:37:59 -0700
Message-ID: <CAAWBYDBRF8JPi6f-Mm1cS6be4-DYVTPqsJK3JW7f1OGRcbgWbQ@mail.gmail.com>
To: Simon Sapin <simon.sapin@exyr.org>
Cc: www-style list <www-style@w3.org>
On Tue, Oct 1, 2013 at 1:35 PM, Simon Sapin <simon.sapin@exyr.org> wrote:
> Hi,
>
> We have two drafts with features that refer to an element from the value of
> a CSS property. They do so with two different mechanisms; I think we should
> pick one preferred way.
>
> * The element() function in css-image-4 takes an ID selector.
> * The cross-reference functions in css-gcpm such as target-counter() take an
> URL (which needs to be in the same document and have a fragment identifier.)
>
> Even though the two may seem similar (#foo), they are different in syntax
> (eg. character escaping) and semantics (<a name=foo> is a fragment target
> but not an ID.)

The syntax is more different than that, actually, since the id
selector can just be "#foo", while a url has to be "url(#foo)".

> ID selectors are the easiest from a spec point of view: we can just refer to
> the Selectors spec and we’re done. For URLs however, we need to define how
> fragments are mapped to elements or refer to something that does. This is
> probably defined in HTML, but CSS so far is supposed to support any type of
> document and maybe shouldn’t depend on HTML.
>
> URLs on the other hand are very nice for using 'attr(href url)' on link
> elements. 'target-counter(attr(href url), page)', for table of contents, is
> a typical use case for target-counter().

I'm fine with defining a more general <element-ref> type, which allows
both ID selectors and <url>s, which can be used for
element()/target-counter()/etc.

~TJ
Received on Tuesday, 1 October 2013 22:38:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 October 2013 22:38:47 UTC