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

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.)


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().

Opinions?

-- 
Simon Sapin

Received on Tuesday, 1 October 2013 20:36:14 UTC