- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Sat, 2 Jan 2010 23:52:02 -0600
- To: Brad Kemper <brad.kemper@gmail.com>
- Cc: www-style list <www-style@w3.org>
On Sat, Jan 2, 2010 at 11:19 PM, Brad Kemper <brad.kemper@gmail.com> wrote: > On Jan 2, 2010, at 7:01 PM, Tab Atkins Jr. wrote: > On the other hand, if there was a pseudo-element to select a string of text wherever it occurred, then that would be powerful, and could also handle suppressing spaces. For instance, lets say you had something like this (with the optional second argument, "i", meaning "case insensitive"): > > p::text("bar",i) { font-weight: bold; } > > <p>Foo Bar Baz</p> > > Then "Bar" would be bold. That suffers from the same problems that are currently keeping us from putting ::selection in a draft: what precisely is the sane thing to do when you have that selector and the code is <p>foo ba<i>r ba</i>z</p>? > So to suppress spaces between each inline-block LI in a UL, you could just use this: > > ul::text(" ") { display: none; } > li::text(" ") { display: inline; } > > This could be limited to text within the same text node, to avoid some of the problems with pseudo-elements like "::first-line". Don't line breaks get normalized to spaces during the whitespace-collapsing step? In that case this code still wouldn't work, as it'd miss those linebreaks. Even if it did work, it's a pretty ugly solution imo to something solved much more simply and elegantly with the white-space-collapse property you pointed out. Something like ::text certainly has some uses I can think of, but I'd rather solve the issue of whitespace handling more directly. ~TJ
Received on Sunday, 3 January 2010 05:52:30 UTC