W3C home > Mailing lists > Public > public-html-xml@w3.org > January 2011

Re: [cowan@mercury.ccil.org: Questions about HTML void elements]

From: Sam Ruby <rubys@intertwingly.net>
Date: Fri, 21 Jan 2011 10:37:46 -0500
Message-ID: <4D39A84A.5020907@intertwingly.net>
To: Henri Sivonen <hsivonen@iki.fi>
CC: public-html-xml@w3.org
On 01/21/2011 09:30 AM, Henri Sivonen wrote:
>> I will note that in my web pages, I emit separate open and close
>> tags for a number of empty svg elements, like<path></path>. I don't
>> do so because it is required for XML validity, XHTML5 conformance,
>> or even HTML5 conformance. I do so because there are legacy user
>> agents out there that don't know the full set of elements which are
>> to be implicitly closed and would have a tendency to build an
>> incorrect DOM if I didn't do this.
> I did so, too this week, as it happens. (And the SVG part worked fine
> on Planet Intertwingly. However, a relative url in<img src>  didn't
> work as I expected and<figcaption>  apparently isn't on the white
> list in Venus.)

I'll add figcaption to the whitelist, but the problem with the relative 
uri is due to the lack of an xml:base in the feed.

> The difference is that<hr>a</hr>  results in "a" being the next
> sibling of hr but<svg><path>a</path></svg>  results in "a" being the
> first child of path. Thus, there's no damage to the mental model in
> the SVG case.

That's one difference.  The other difference is that <hr/>a results in 
"a" being the next sibling of hr, but <svg><path/><path/></svg> results 
in the second path being a child of path in legacy html and sgml 
parsers.  What's worse is that in a number of cases, this subsumes the 
remainder of the document.

HTML is an unadulterated mess.  The "pure" mental model that you seem to 
aspire to which would suffer "damage" as a result of totally innocuous 
closing-tags simply does not exist.  The absolute best that can be hoped 
for is a simple set of rules that people can follow.

"Always explicitly close everything but <br>" is such a simple rule.

- Sam Ruby
Received on Friday, 21 January 2011 15:38:19 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:58:27 UTC