[whatwg] several messages about XML syntax and HTML5

Lachlan Hunt lachlan.hunt at lachy.id.au
Mon Dec 4 14:19:04 PST 2006


Michel Fortin wrote:
> Le 4 déc. 2006 à 6:10, Mihai Sucan a écrit :
> 
>> However, in the same "spirit", a middle way for those who want 
>> XMLiness in HTML, would be to allow the xmlns:?.* attribute, xml:base, 
>> xml:id, and xml:lang. Yet, define them as meaningless. Just for 
>> validation purposes, just for helping people who do such things on the 
>> server-side.
> 
> I disagree. I think xmlns="http://www.w3.org/1999/html" is fine in HTML 
> because it just states what is already implied.

Technically, it doesn't even do that.  It's just completely useless in HTML.

> But I think allowing attributes with no meaning to validate will just 
> reenforce the idea that they are meaningful.

I agree, but how are xml:lang, xml:base and xml:id any more meaningless 
in HTML than xmlns?

The only reason xmlns was allowed was to help ease migration from 
current XHTML 1.0 to HTML5.  Although that logic made sense for '/>' 
which you often find scattered throughout many different files, which 
makes it difficult to update, the xmlns attribute occurs in one place, 
and that's usually in the same file as the DOCTYPE (in cases where 
templates are used).

In such cases, if the author is able to so easily change the DOCTYPE, 
they can most certainly strip the xmlns attribute.  Let's see how easy 
that is:

1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    ...

2. <!doctype html>
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    ...

Gosh, look!  We're already half way done, why stop there?  It's just one 
more step to remove the xmlns and, in this case, xml:lang attributes:

3. <!doctype html>
    <html lang="en">
    ...

And we're done.  That took me a whole 3 seconds to do.  Does it really 
seem like making that final step unnecessary, at the expense of 
introducing useless junk into HTML?

-- 
Lachlan Hunt
http://lachy.id.au/



More information about the whatwg mailing list