Re: A Call for ::nth-everything

> On 31/10/11 21:57, Charles Pritchard wrote:
>> On 10/31/11 12:30 PM, Lars Gunther wrote:
>>> Bringig this to your attention
>>>
>>> http://css-tricks.com/14771-a-call-for-nth-everything/
>>
>> I've used "nth-char" as a step in an HTML rendering engine 
>> (canvas+js), not to select a single character but to update my 
>> current style for rendering inline text. It was handy and easier than 
>> specifying and calculating ranges.
>>
>> The nth-everything proposal does not include ranges.
>> I'd like ::nth-letter(3, 10) -- an offset and a length.
>>
>> That'd save me a lot of unwanted <span> manipulation.
>>
>> -Charles
>>
> That could be done with a combination of ::nth-letter rules if we 
> become able to chain certain pseudo-elements (which is highly 
> requested in other threads, not sure how it's going):
> Letter >= 3 is ::nth-letter(n+3)
> Letter <= 10 is ::nth-letter(-n+10)
> Combining them: ::nth-letter(n+3)::nth-letter(-n+10)
Wouldn't a comma be a little more compact?

> However, I have a hunch that these suggestions, even though undeniably 
> useful, will probably prove out to be very hard to implement in a 
> reasonably performant way :(

They're going to be more performant than cluttering the DOM with span 
nodes. Given that nth-letter lacks semantic meaning, implementors won't 
have to clutter the accessibility tree either.

nth-letter is specified in the same manner as ecmascript substr.

Yes, it will break-apart ligatures when needed, just as <span> would.

-Charles

Received on Tuesday, 1 November 2011 17:25:06 UTC