Re: Making the HTML language self-describing

Hallvord R. M. Steen wrote:
> Jonas already suggested these:
>> 2. Allow a trailing '/' to indicate an empty element on all unknown 
>> elements.
> 
> I'm slightly wary of this because browsers don't currently do it. Hence 
> we'd be introducing incompatibility with existing content - but I don't 
> know how serious a pain it will be. If we are going to let authors mark 
> future void tags as void, "/>" is the absolutely simplest approach so 
> it's a tempting idea.

This seems dangerous to me. I think authors will start expecting that 
all elements can be closed with a trailing solidus. I also expect 
(without any actual data or anything) that it would break too much 
existing content to be viable.

>> 3. Make it conforming to write void elements as <foo></foo>. I.e.
>> <eventsource></eventsource> would be conforming and equivalent to
>> <eventsource>.
> 
> I think this would confuse authors more, and be more typing and work for 
> them. For better or worse, many people already are familiar with /> 
> because of the common <br /> and because of XML.

I think this idea is better. Specifically I think that it should be 
conforming to have an end tag for a void element but only if there are 
no tokens between the start tag and the end tag. Obviously </br> would 
be an exception but it wouldn't be HTML if there wasn't at least one 
weird exception to every rule. This syntax is likely to be more compact 
than the alternative <span><void></span> and has the advantage that 
there is no need to update scripts/stylesheets etc when you remove the 
hack in the future (or start authouring new content without the hack but 
with the same scripts/stylesheets). I also think the syntax is 
sufficiently obvious that people copy-and-pasting markup are likely to 
just copy the whole thing (start+end tag) so that it will continue to 
work in HTML 5 browsers even if they only test it in HTML 5-unaware 
browsers. It seems less obvious that that would happen with the <span> 
hack.

The requirement to have a closing tag doesn't seem that onerous. For 
example authors are already used to the idea that <script src> must be 
spelt <script src></script> rather than <script src /> even though a 
script referencing an external js file is conceptually a void element.

On the other hand there is a not-unreasonable argument that we should 
wait and see if this is an actual problem that affects adoption of HTML 
5 before we rush to solve it.

Received on Monday, 12 January 2009 11:07:59 UTC