Re: [css3-images] [css3-gcpm] element() and element()

On Wed, Mar 7, 2012 at 2:08 PM, Bert Bos <bert@w3.org> wrote:
> On Mar 1, 2012, at 03:21, fantasai wrote:
>> On 02/29/2012 04:10 PM, Tab Atkins Jr. wrote:
>>> On Wed, Feb 29, 2012 at 3:57 PM, Simon Fraser<smfr@me.com>  wrote:
>>>> element() in the CSS Image case doesn't immediately strike me
>>>> as meaning a snapshot of the targeted element. Maybe we should
>>>> use something more descriptive, like:
>>>>
>>>> snapshot() (even though it updates)
>>>> replica()
>>>> element-image()
>>>> imageof()
>>
>> I think this is a good usability point.
>
> Did somebody already suggest to just use url() and image()?
>
> url(#foo) refers to the element with ID foo in the current document.
>
> Because it's a URL, you can even use Xpointer to refer to elements without IDs. And there is a Community Group[1] that is proposing to extend Xpointer to allow CSS selectors and not only XPath.

This is not backwards compatible.  First, url(#foo) will *usually*
refer to the element with id=foo in the current CSS file (which is
nothing, since CSS files don't have elements), *not* the document
linking the CSS file.  URLs are always resolved relative to the file
the rule appears in.  Second, processing of links like
"url(http://example.com#foo)" currently acts by simply ignoring the
hash and attempting to display the entire page as an image.  There is
likely content that would end up with the wrong image if this was
changed.

However, I think letting element() take a url in a future level is a good idea.

> And a second advantage: If you can use url(), then you can automatically also use attr(), because attr() can be a URL, too:
>
>    A:local-link:after { content: "(" attr(href, url) ")" }

Nothing wrong with adding an 'element' or 'selector' type to attr() in
the future to address this kind of thing.

> (And a possible third advantage: If you use url() and attr(), then you can also use the target-text() that GCPM proposes in case you want just the text of the referenced element and not the style.)

I'm not sure how that would render.

~TJ

Received on Wednesday, 7 March 2012 22:32:23 UTC