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

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

> On Tue, 16 Jul 2013, Takayoshi Kochi ($B2OFb(B $BN4?N(B) 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">$BANV}$(D7q(B</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

Received on Thursday, 25 July 2013 00:52:18 UTC