W3C home > Mailing lists > Public > www-style@w3.org > January 2010

Re: Text selector [was Re: breaking overflow]

From: Brad Kemper <brad.kemper@gmail.com>
Date: Tue, 5 Jan 2010 16:37:46 -0800
Message-Id: <1B418C91-B1A6-4C9F-B2FE-5CCB75132F8D@gmail.com>
To: "robert@ocallahan.org" <robert@ocallahan.org>
Cc: Bobby Jack <bobbykjack@yahoo.co.uk>, Boris Zbarsky <bzbarsky@mit.edu>, "Tab Atkins Jr." <jackalmage@gmail.com>, www-style list <www-style@w3.org>


On Jan 5, 2010, at 3:59 PM, "Robert O'Callahan" <robert@ocallahan.org>  
wrote:

> On Wed, Jan 6, 2010 at 12:40 PM, Brad Kemper <brad.kemper@gmail.com>  
> wrote:
> I could live with that, if it's as fast as JavaScript regexp  
> processing. Simple regexp and literals run pretty fast, don't they?  
> And dynamic element changes also require rematching. I don't think  
> I'd want it to run the matching every second as I typed into  
> editable HTML.
>
> That's exactly what a browser has to do.

I meant to say "every microsecond" or "every CPU cycle". If it waited  
for a one second pause in editing before refreshing styles, I think it  
would enhance performance significantly, even when using today's CSS.  
That shouldbe plenty, epecially if you are only looking at the text  
nodes of the currently changing innermost element for rule matches.

> No way. Talk about idealistic goals that cant be reached! I should  
> have the content/markup author tell the UA where all the numbers  
> are, just because I want to style them differently? I should insist  
> on a separate class for every phone number that matches a particular  
> one that I might be interested in styling? What HTML tag do I use  
> for a ">" that represents another level of breadcrumbs? These are  
> all things that I cannot reasonably expect to be in the markup, but  
> that I may want to style. There are already many places where  
> authors are adding extra spans in the HTML just to get a  
> presentational effect, and I think we should provide ways to  
> alleviate that where we can.
>
> Sure, but that set of examples aren't just presentational effects,  
> they have semantic meaning. Maybe not expressible in HTML directly,  
> but there's nothing "wrong" with adding classes for them.
>
> CSS needs some cooperation from the document author.

It helps. But the CSS author can very often expect NO cooperation from  
the HTML author beyond what they have already created. And it is  
usually unreasonable to expect a whole site to be re-coded in order to  
acheive non-essential (but desirable) presentational effects.

> Even using ::text("Example \d: *\n"), the author has to make sure to  
> put the right number of spaces in, which is arguably harder to get  
> right than wrapping the text in a span with a class.

I disagree. In that example, I already have 0-many spaces that can  
come before line break. If I was really worried about unexpected white  
space, I could rewrite that single pattern string as "Example\s+\d:\s* 
\n". But that is kind of ugly. I would much rather have the pattern  
matched against a copy of the element's text that had already had the  
white space collapsed (so if the element had 'white-space: normal',  
all source code white space would be collapsed to single spaces, and  
<br> elements would be read as "\n").





>
> Rob
> -- 
> "He was pierced for our transgressions, he was crushed for our  
> iniquities; the punishment that brought us peace was upon him, and  
> by his wounds we are healed. We all, like sheep, have gone astray,  
> each of us has turned to his own way; and the LORD has laid on him  
> the iniquity of us all." [Isaiah 53:5-6]
Received on Wednesday, 6 January 2010 00:38:33 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:23 GMT