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

Ryosuke Niwa rniwa at apple.com
Wed Jul 24 17:51:54 PDT 2013


On Jul 16, 2013, at 11:25 AM, Ian Hickson <ian at hixie.ch> wrote:

> On Tue, 16 Jul 2013, Takayoshi Kochi (河内 隆仁) wrote:
>> 
>> IIUC WebKit uses internally node's language to determine which font to use
>> to render text,
>> e.g for Han unification (https://en.wikipedia.org/wiki/Han_unification)
>> WebKit has to choose
>> a proper glyph depending on its lang attribute for the same Unicode
>> codepoint.
> 
> Sure, but internal UA uses aren't use cases for the Web.
> 
> The use cases Peter gave over the weekend are valid, though.

The fact browsers use the "effective" language for font selection is very relevant in HTML editing. For example, consider the following document:

<!DOCTYPE html>
<html lang="ja>
<html>
<body>
<section lang="zh">
<p id="source">僧廐埩</p>
</section>
<blockquote>
<p id="destination"></p>
</blockquote>
</body>
</html>

If you were to get the innerHTML of #source and insert it into #destination, the effective language changes from Chinese and Japanese and the three characters transform their shapes because browsers will use different fallback fonts.

- R. Niwa




More information about the whatwg mailing list