Re: [whatwg] HTML: A DOM attribute that returns the language of a node

On Wed, May 1, 2013 at 1:49 AM, Robert O'Callahan <robert@ocallahan.org>wrote:

> On Wed, May 1, 2013 at 8:01 PM, Elliott Sprehn <esprehn@chromium.org>wrote:
>
>> fwiw WebKit (and Blink) implement this through CSS inheritance since you
>> need to know the lang for all kinds of things and walking up the DOM
>> repeatedly would be expensive.
>>
>> -webkit-locale is inherited by default and contains the enclosing @lang
>> value. You can query it through getComputedStyle(node).webkitLocale. That
>> doesn't help your custom parser though.
>>
>
> Interesting. What does "body:lang(en) { -webkit-locale:fr; }" do? :-)
>
>
Nothing sensible. :) We still walk up the tree when doing selector
matching, but you'll confuse some render tree operations. Looking through
the code again we don't use -webkit-locale as much as I thought, though
perhaps we should and prevent user CSS from tampering with it.

- E

Received on Wednesday, 1 May 2013 10:53:12 UTC