[whatwg] HTML: A DOM attribute that returns the language of a node
Anne van Kesteren
annevk at annevk.nl
Wed May 1 04:43:36 PDT 2013
On Wed, May 1, 2013 at 9:01 AM, 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.
What mechanism did you use for base URLs? Or is the cost there deemed
For direction you need to have a similar mechanism available. (And
you'll have the same problem roc pointed out with :lang() if you solve
that through CSS as :dir(ltr) and :dir(rtl) exist these days.)
If browsers already implement some kind of API for these things it
might be worth to expose them in the same way.
More information about the whatwg