- From: Brad Kemper <brad.kemper@gmail.com>
- Date: Fri, 13 Apr 2012 06:32:28 -0700
- To: Divya Manian <manian@adobe.com>
- Cc: Andrew Fedoniouk <news@terrainformatica.com>, Lea Verou <leaverou@gmail.com>, "www-style@w3.org" <www-style@w3.org>
On Apr 12, 2012, at 2:18 PM, Divya Manian <manian@adobe.com> wrote:
> On 4/11/12 9:21 PM, "Andrew Fedoniouk" <news@terrainformatica.com> wrote:
>
>> Ideally we should have one mechanism that covers all use cases, not two
>> of them.
>>
>> This for example:
>>
>> div[title] -> :tooltip { background:gold; font-size: x-large; }
>>
>> does exactly as yours:
>>
>> div[title]::tooltip { background:gold; font-size: x-large; }
>
> No it does not. You are asking for completely different set of features
> from what Lea did. All Lea suggests we have is a way to style the tooltips
> that browsers show on <abbr> or image elements. You are suggesting we add
> a state to an existing element that somehow becomes a tooltip by some
> magic (how?)
Pseudo-classes are not just state based. For instance, ':nth-child' selects an object that wasn't otherwise selectable, and I think that is why there is some confusion. But it is still selecting an actual document element, and a tooltip is not an element (the title attribute is a node, but CSS deals with those differently). So I agree that a pseudo-class is not appropriate for selecting and styling a tool tip.
For some pseudo-elements, you can grab content from elsewhere. We have 'content' and 'flow-from' (regions) that could provide that content for '::tooltip'. 'Content' could grab it from the 'title' attribute, like this:
div::tooltip { content: attr(title); background: gold; font-size: x-large; }
In this case, if no title attribute exists, then there is no content. If there is no content, then the pseudo-element does not appear (just as with '::before' and '::after'). So we don't actually need '[title]' in the selector.
Or we we could implicitly by default grab whatever the UA puts into tooltips (typically the 'title' attribute content), the way ::first-line provides its own content. But pulling in content from other sources too would be a powerful and useful feature. With region's 'flow-from', the tooltip could be more than just a string of text.
> These are not use cases for the same "feature" and need to be talked about
> separately.
Received on Friday, 13 April 2012 13:33:08 UTC