[whatwg] [WA1] lang and xml:lang

Ian Hickson wrote:
> On Sun, 17 Apr 2005, Lachlan Hunt wrote:
> 
>># If both the xml:lang attribute and the lang attribute are set, user
>># agents must use the xml:lang attribute, and the lang attribute must be
>># ignored for the purposes of determining the element's language.
>>
>>Is that the case for both HTML and XHTML documents?
> 
> Yes.

So, if I have this HTML document

   <!DOCTYPE ...>
   <html lang="en" xml:lang="fr">
   <title>HTML document</title>
   <p>This is an HTML, not an XML, document.

Considering that legacy HTML UAs won't know about the xml:lang 
attribute, and will only use lang, are you saying that a conforming Web 
Apps UA should treat the document as french?

>>It would make more sense if, in the case of both being set, lang was 
>>used for text/html documents and xml:lang for XML documents.
> 
> The only way you can set xml:lang in an HTML document is via the DOM

Now I'm confused.  If that's the case, then wouldn't the above example 
be treated as english, regardless of the xml:lang attribute in the source?

> (in HTML, there are no namespaces).

Which is why xml:lang should be completely ignored, as an unknown 
attribute, in HTML.

> I don't think it's worth having special requirements for something
> that no-one is likely to ever do outside of obscure test cases.

I've seen people use lots of XML syntax in HTML documents, including 
xmlns and xml:lang attributes even in one that had an explicit HTML4 
DOCTYPE (though I can't remember where) and not just in MS Word 
generated rubbish.  The point is authors do a lot of silly things, and I 
thought UA behaviour needed to be well defined for as many use cases as 
possible.

>>However, in the case of only one being set but for the wrong MIME type 
>>(eg. xml:lang set for text/html document or lang for XML document), for 
>>error recovery, should UAs be allowed to fallback on it?
> 
> If xml:lang="" is set onin a text/html document, it'll be {html, 
> 'xml:lang'}, not {xml, 'lang'} which is what xml:lang really is.

I don't understand how that answers the question.

-- 
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/     Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox

Received on Sunday, 17 April 2005 05:00:54 UTC