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: Wed, 6 Jan 2010 06:27:47 -0800
Cc: www-style list <www-style@w3.org>
Message-Id: <06C49089-AC1D-4CF9-99F6-65383E5BBA91@gmail.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>

On Jan 5, 2010, at 7:11 PM, Boris Zbarsky wrote:

> On 1/5/10 7:37 PM, Brad Kemper wrote:
>> I would much rather have the pattern matched
>> against a copy of the element's text that had already had the white
>> space collapsed
> You can't have it both ways.  Either these boxes

> allow arbitrary styling (and you have to match on the DOM)

> or you match after whitespace collapsing, which means after style computation and box construction (both of which affect whitespace collapsing) and then your styling must not create any new boxes, or must severely limit how the boxes can be styled.

I was imagining something more like the following:

1. look at the DOM for elements that match the selector (not considering the pseudo-element part yet)
2. for each match, create a temporary array in which the innerHTML is divided by any element that is not a comment (so that each slot of the array contains only text and comments)
3. discard comments from each slot
4. pre-compute just the white-space for the element, and discard or collapse white-space into individual spaces in each of the slots, according to that resolution
5. run the regexp against each slot, creating pseudo-elements for each match.
6. do the rest of the style computation and box construction

>> (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").
> And then you put "white-space: pre" on the ::text and things stop making sense, no?

No; things make more sense. The concept was that comparison is made against a pre-collapsed copy of the element (so that what the author is matching against is similar to what he would otherwise see), but it is still present in the DOM. If you want to put 'white-space: pre' on pseudo-element after that, then the white space is all still there for you to do so.

Received on Wednesday, 6 January 2010 14:28:25 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:07:42 UTC