W3C home > Mailing lists > Public > www-style@w3.org > November 2011

Re: A Call for ::nth-everything

From: Charles Pritchard <chuck@jumis.com>
Date: Tue, 01 Nov 2011 10:24:26 -0700
Message-ID: <4EB02B4A.3010308@jumis.com>
To: Lea Verou <leaverou@gmail.com>
CC: Lars Gunther <gunther@keryx.se>, "www-style@w3.org" <www-style@w3.org>
> 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.

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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:06 UTC