- From: Lachlan Hunt <lachlan.hunt@iinet.net.au>
- Date: Fri, 21 May 2004 01:12:55 +1000
- To: W3C Style List <www-style@w3.org>
Anne van Kesteren (fora) wrote: > >> I've been reading over the current CSS3 Selectors CR — specifically, >> at the :contains() pseudo class. It states that, since it's a >> pseudo-class it applies to the whole element that contains the text, >> not just the text within the element. So, I'm asking why is there no >> pseudo-element that does just select the text within? > > There has been a lot of criticism on the ':contains()' pseudo class and > it is likely to be removed. [1] and other resources. Probably some > discussion behind closed (W3C) doors. Well that's a shame, it could have been useful, especially because I suspect that it's implementation could have helped with the implementation of something like a ::string() pseudo element. However, even if it is removed from the current spec, that shouldn't prevent it from being revised and included in a future spec. Anyway, the main point of this email is that I've thought of another use where a ::string() pseudo element would be useful. In the HTML 4.01 spec, in the section on access keys [1], the last paragraph states the following: "...User agents should render the value of an access key in such a way as to emphasize its role and to distinguish it from other characters (e.g., by underlining it)." Using something like the proposed ::string() pseudo-element, this could be styled with a rule like this: label[accesskey]::string(attr(accesskey)):first-of-type { text-decoration: underline; } which would underline the first occurance of the accesskey within the label. eg. <label accesskey="t">test</label> would render like: _t_est Although that syntax probably isn't perfect, since I don't think it's currently possible to include a function within a selector like that, but anyway, I think the concept of the ::string() is worth looking, even if the syntax isn't. [1] http://www.w3.org/TR/html401/interact/forms.html#access-keys -- Lachlan Hunt http://www.lachy.id.au/
Received on Thursday, 20 May 2004 11:13:57 UTC