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

Le 01/10/2013 21:35, Simon Sapin a écrit :
> 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?
>

As pointed out during the conf call, the 
nav-up/nav-right/nav-down/nav-left propeties from css-ui-3 also refer to 
elements. They do so with '#' + identifier, which is the syntax of ID 
selectors.

Even though the spec says "similar to a fragment identifier in a URL", 
the behavior the intent seems to have the behavior of ID selectors.

In Opera 12 (Presto), this test case highlights "bar" when hitting 
SHIFT+RIGHT twice:

data:text/html,<button style="nav-right:%23bar">foo</button><a%20id=bar>bar

This one doesn’t indicating that Presto’s implementation indeed is 
closer to ID selectors than URL fragments.

data:text/html,<button 
style="nav-right:%23bar">foo</button><a%20name=bar>bar


To sum up, css-ui-3 uses the same mechanism as css-images-4, ID 
selectors. (The latter adds an element() function, but that’s just for 
disambiguation with other image values.)

-- 
Simon Sapin

Received on Wednesday, 2 October 2013 17:49:18 UTC