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

> 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.)

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.

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

Received on Friday, 21 January 2011 14:31:24 UTC