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

Elliott Sprehn esprehn at chromium.org
Wed May 1 03:52:04 PDT 2013


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

> On Wed, May 1, 2013 at 8:01 PM, Elliott Sprehn <esprehn at 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



More information about the whatwg mailing list