W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2007

[whatwg] Map lang to xml:lang at the parser level

From: Ian Hickson <ian@hixie.ch>
Date: Thu, 14 Jun 2007 21:55:38 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.0706142153000.30490@dhalsim.dreamhost.com>
On Sun, 15 Oct 2006, Simon Pieters wrote:
> 
> When parsing HTML and serializing as XML you normally want to change the 
> lang attribute to xml:lang. But why not put it in the XML namespace at 
> the parser level? Then when you serialize the DOM as XML it becomes 
> xml:lang automatically.
> 
> The .lang DOM attribute would reflect xml:lang. This would make it 
> simpler to set/get the language with script in XHTML (no need to use 
> namespace-aware methods).
> 
> I don't know if this is too expensive on the parser or if there are 
> other flaws but it's just an idea.

It's an interesting idea but it isn't really compatible with what legacy 
UAs do, since they would expose the attribute as 'lang' but this would 
require them attribute to be fetched using getAttributeNS instead of 
getAttribute to get the same effect.

There are enough other subtleties in the differences between HTML5 and 
XHTML5 that I think you'd have to have special code to convert between the 
two anyway. So I'm not sure this would gain you much.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 14 June 2007 14:55:38 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:56 UTC