Re: foo {content:title} - a proposal

Le 13/03/2013 17:50, Leif Halvard Silli a écrit :
> Hi Simon, thanks for getting the terminology right! HTML5 on @title:
>
>     "If this attribute is omitted from an element, then it implies
>      that the title attribute of the nearest ancestor HTML element
>      with a title attribute set is also relevant to this element."
>      http://www.w3.org/TR/html5/dom.html#the-title-attribute
>
> So one could claim that @title is inherited like @lang.

So if I read this right, there is an "abstract" concept of "title of an 
element" that is similar to "language of an element", but it is not an 
actual attribute that can be accessed with `content: attr(title)`.


> With regard to GCPM’s named strings, then it sounds a bit complicated.
> For instance because the title keyword in GCPM does not have anything
> to do with the title attribute, as much as I understand. But perhaps
> you could show an example of how it would have worked?

Yes, named strings are more complicated than just a 'title' keyword, but 
they cover many more use cases. This example:

    <label title="Advisory text.">
       <input type="text" />
       <span><::before>Advisory text</::before></span>
    </label>

could be obtained with:

     label[title] { string-set: title attr(title) }
     label[title] span::before { content: string(title) }


-- 
Simon Sapin

Received on Wednesday, 13 March 2013 19:03:43 UTC