W3C home > Mailing lists > Public > www-tag@w3.org > March 2013

Re: Why polyglot is needed

From: Michael[tm] Smith <mike@w3.org>
Date: Wed, 20 Mar 2013 04:32:22 +0900
To: "Henry S. Thompson" <ht@inf.ed.ac.uk>
Cc: www-tag@w3.org
Message-ID: <20130319193222.GK13611@sideshowbarker>
"Henry S. Thompson" <ht@inf.ed.ac.uk>, 2013-03-19 19:05 +0000:

> My university serves html files as text/html.  I have no control over
> that.

What kind of Web server does your university use? You really don't have the
ability to add an .htaccess file or equivalent? If you lack anything like
that, it kind of sounds like your university's system is broken, from a
user-experience point of view. Why don't you ask your university to fix that?

Creating a new document class instead of fixing broken systems that aren't
meeting your needs and the needs of other users doesn't seem to me like the
best way to address the underlying problems.

> If I don't produce polyglot, browsers do the wrong thing with,
> for instance [1], void tags.

It's not the wrong thing. It's the different-from-XML-thing or the
behavior-that-browsers-have-consistently-had-before-XML-was-invented thing.

> The document at [1] looks like this:
> 
> <!DOCTYPE html>
> <html xmlns="http://www.w3.org/1999/xhtml">
>   <head>
>     <title>test void element closure</title>
>     <style type="text/css">a {background-color: pink}</style>
>   </head>
> 
>   <body>
>     <h1>test void element closure</h1>
>     <p><a name="test" />Inside or outside?</p>

That's not valid per HTML5. The name attribute is not allowed on the <a>
element. There is now never any good reason to use it. You can just use an
id attribute on the p element to achieve the same effects.

>     <hr/>
>     <address><a href="mailto:ht@inf.ed.ac.uk">Henry S. Thompson</a></address>
>   </body>
> </html>
> 
> Served as application/xml+xhtml, it validates [2] and displays
> correctly (in Firefox 17, Chrome 26, IE9).  Served as text/html, it
> doesn't parse [3]

It parses fine. It just doesn't validate.

> and displays incorrectly (same browsers).

It displays exactly as expected given the rules for parsing text/html we
have always had since the language was created.

> ht
> 
> [1] http://www.ltg.ed.ac.uk/~ht/void_test.html
> [2] http://validator.w3.org/check?uri=http%3A%2F%2Fwww.ltg.ed.ac.uk%2F~ht%2Fvoid_test.xhtml&charset=%28detect+automatically%29&doctype=HTML5&group=0
> [3] http://validator.w3.org/check?uri=http%3A%2F%2Fwww.ltg.ed.ac.uk%2F~ht%2Fvoid_test.html&charset=%28detect+automatically%29&doctype=HTML5&group=0

-- 
Michael[tm] Smith http://people.w3.org/mike
Received on Tuesday, 19 March 2013 19:32:25 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 19 March 2013 19:32:25 GMT