Re: Why polyglot is needed

On Tue, Mar 19, 2013 at 9:05 PM, Henry S. Thompson <ht@inf.ed.ac.uk> wrote:
> My university serves html files as text/html.  I have no control over
> that.  If I don't produce polyglot,

You don't need to produce polyglot. If you serve text/html, it's
sufficient to produce (valid) HTML. It doesn't need to be polyglot.

> browsers do the wrong thing with,
> for instance [1], void tags.

The only void element in that example is <hr/>. Voidness is bound to
the element name--not to a slash. (The term "void" was coined to
distinguish intrinsically end-tagless elements from the XML case where
any element can opt out of having an end tag in any given instance.)

> Served as application/xml+xhtml, it validates

But served as text/html, it doesn't:
http://html5.validator.nu/?doc=http%3A%2F%2Fwww.ltg.ed.ac.uk%2F~ht%2Fvoid_test.html

The solution is either both serving and validating as text/html or
both serving and validating as application/xhtml+xml (and fixing the
errors the validator finds either way). No need for polyglot.

(The validator also says: "The name attribute is obsolete. Consider
putting an id attribute on the nearest container instead.")

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Wednesday, 20 March 2013 13:12:44 UTC