Re: Are new void elements really a good idea?

Julian Reschke wrote:
> 
> The "<tagname />" syntax is not allowed in HTML4, and thus existing 
> libraries that have been designed to produce HTML4 will not use it.
> 
> On the other hand, what, except ideological reasons, stops us from allowing
> 
>  <tagname></tagname>
> 
> as well?

Allowing both syntaxes means there are more opportunities for authors to 
get confused, and makes the language a bit more complex.

E.g. <embed> is a void element, and so there's never a need to write 
</embed>; but most people (something on the order of 80%) write <embed 
...></embed> anyway. The W3C validator doesn't tell people to just write 
<embed ...> (since instead it complains that 'embed' is not defined in 
HTML4), so they have no reason to learn and promote the simpler way of 
writing it.

Hypothetically, people who are used to writing <embed ...></embed> may 
get confused when they see a page with just <embed ...>, and incorrectly 
think that the page is wrong. (I don't know if this a problem in reality.)

Also hypothetically, people might write <embed ...>Fallback 
content</embed> and expect it to work, since all other elements in HTML 
with start+end tags can contain some content. That's easier to test: 
Looking at some tens of thousands of pages to find some with non-empty 
<embed>s, they all seem to contain either whitespace (spaces, &nbsp;, 
<br>) or <noembed>. That use of <embed 
...><noembed>...</noembed></embed> is a bit confused, but harmless. I 
don't see any cases where there's a real problem caused by this on 
public sites. (But I have no idea how many authors would have 
encountered a real problem while testing it themselves privately, and 
fixed it before uploading.)

-- 
Philip Taylor
pjt47@cam.ac.uk

Received on Sunday, 31 August 2008 12:11:40 UTC