Re: Text selector [was Re: breaking overflow]

--- On Tue, 1/5/10, Robert O'Callahan <robert@ocallahan.org> wrote:

> Personally I don't think we should have ::text at all.
> I think there are all kinds of pitfalls associated with
> trying to apply style to a particular text string.

I've been waiting for someone to say that! :)

> For one thing, it makes style dependent on details of the content in
> a way that seems rather fragile (e.g., "I just fixed a
> typo, why did my styles go away?").

Agree. It also makes translation a pain (i.e. stylesheets need to be translated in addition to content) and, I fear, could lead to situations in which it's very difficult to determine which styles are applied. 

> It's going to be hard to spec, hard to
> implement, and potentially confusing to use.

And, given that, I think we need to ensure there are some strong use cases before considering this any further. The common use case seems to be, for example, a heading consisting of several words, each of which needs to be styled independently. As suggested, this can currently be achieved using additional span elements, although this is certainly not ideal - how would one plan for this at the structural level?
Having said that, I think this particular use case can be handled with a more structural, less content-dependent selector such as ::word(n) (which I don't think exists anywhere).

Are there any other use cases?

- Bobby

Received on Tuesday, 5 January 2010 10:10:20 UTC