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

On 01/21/2011 08:04 AM, Henri Sivonen wrote:
>> I note that your email above says that the void elements must not
>> generate an end-tag, but in fact end-tags should be safe for all
>> of them except br, even though empty-tags or SGMLish start-tags are
>> the only valid alternatives.
>>
>> Right?
>
> Safe in the sense they don't change the results of the parse. Not
> safe in the sense of doing damage to the mental model Web authors
> have about how stuff works.

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.

It is a trade-off.  Idealogical purity vs interoperability.  I tend to 
favor the latter.  So while I agree with Henri that one SHOULD avoid 
end-tags for well-established void HTML elements, I personally differ 
with his recommendation on some of the newer and more obscure elements.

- Sam Ruby

Received on Friday, 21 January 2011 13:54:59 UTC