- From: Lachlan Hunt <lachlan.hunt@iinet.net.au>
- Date: Tue, 18 May 2004 23:49:31 +1000
- To: W3C Style List <www-style@w3.org>
Hi,
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?
For example, I'll use ::string() as the pseudo element, however, the
exact name for it is not that important yet, and can be changed.
<h1>Hello World!</h1>
with the style
h1::string("World") { content: url(world.png); }
would create the fictional tag sequence like:
<h1>Hello <h1::string>World</h1::string>!</h1>
This would replace the text "World" with an image of the world, leaving
the rest of the text unchanged.
Since UAs will already be able to find elements that contain text
because of the :contains() pseudo-class, it shouldn't be too hard to
extend that to be able to surrond the text with a pseudo-element.
Obviously I'm too late to be considered for the current Selectors
Candidate Recomendation, but maybe the next time a new draft comes out,
this idea could be included.
I'm sure there would be lots of issues with this, such as how it
handles multiple occurances of a string, or how it would handle
overlapping occurances or any other issue you can think of. So please,
let me know what you think.
--
Lachlan Hunt
http://www.lachy.id.au/
lachlan.hunt@lachy.id.au
Received on Tuesday, 18 May 2004 09:49:46 UTC