[whatwg] HTML5 Parsing spec first draft ready

Simon Pieters zcorpan at hotmail.com
Sat Mar 11 06:17:19 PST 2006


Hi,

From: Henri Sivonen <hsivonen at iki.fi>
>BTW, the spec also says: "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."
>
>Shouldn't lang take precedence in HTML?

According to the terminology [1] "xml:lang" means the lang attribute in the 
XML namespace. You can have it in HTML documents with script:

   <!doctype html>
   <html lang=x-fail>
    <title>xml:lang vs lang</title>
    <style>
     html:lang(x-pass) { background:lime; }
     html:lang(x-fail) { background:red; }
    </style>
    <p>FAIL (script did not run).
     <script>
      
document.documentElement.setAttributeNS("http://www.w3.org/XML/1998/namespace", 
"lang", "x-pass");
     document.body.firstChild.firstChild.data = "This page should have a 
green background.";
     </script>

Why should the lang attribute (in the null namespace) take precedence in 
HTML?

[1] http://whatwg.org/specs/web-apps/current-work/#terminology

Regards,
Simon Pieters





More information about the whatwg mailing list