- From: Brad Kemper <brad.kemper@gmail.com>
- Date: Fri, 13 Apr 2012 10:18:34 -0700
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: Divya Manian <manian@adobe.com>, Andrew Fedoniouk <news@terrainformatica.com>, Lea Verou <leaverou@gmail.com>, "www-style@w3.org" <www-style@w3.org>
On Apr 13, 2012, at 9:18 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote: > On Fri, Apr 13, 2012 at 8:28 AM, Brad Kemper <brad.kemper@gmail.com> wrote: >> On Apr 13, 2012, at 8:14 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote: >>> On Fri, Apr 13, 2012 at 6:32 AM, Brad Kemper <brad.kemper@gmail.com> wrote: >>>> 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. >>> >>> Actually, you do, as attr() will return the empty string in that case, >>> and the empty string is a valid value for 'content' that should cause >>> it to be generated. >> >> Is that considered useful? Why not null if the attribute doesn't exist, and empty string it exists with no value or empty value? > > Because attr() needs to have a specific type, and in that expression > the type is "string". If attr() could return multiple types we can't > detect syntax errors with it. > > Also, null isn't a CSS value. ^_^ OK, but it could just make it invalid if the attribute didn't exist, couldn't it? > (You could, of course, instead do "content: attr(title, none);". The > default value doesn't need to be of the declared type.) And that is useful?
Received on Friday, 13 April 2012 17:19:11 UTC