Re: Void elements in HTML (Was: ZIP-based packages and URI references into them ODF proposal)

On Tue, 30 Dec 2008, Julian Reschke wrote:
> Ian Hickson wrote:
> > ...
> > I don't understand. Producers know which syntax to use because the spec very
> > precisely defines the exact syntax to use in the "Writing HTML documents"
> > section, and consumers know how to process this syntax because of the very
> > precise rules in the "Parsing HTML documents" section.
> > 
> > What's the problem?
> 
> For unknown elements?

I don't understand the question. Producers aren't allowed to produce 
unknown elements, by definition. Consumers follow the parsing rules and 
get interoperable behavior on all elements, unknown or otherwise.


> > Why not? Void elements are great, and other than a little pain every 
> > few years when new ones are introduced, they don't cause any long-term 
> > problems. After all, the pain caused by new void elements is minute 
> > compared to the pain of actually implementing those new elements.
> 
> The pain is substantial if it means that serializers and parsers need to 
> be updated for no other reason than that change.

I agree that if we were defining the language from scratch, we would be 
better off with a syntax that was self-describing. Sadly, that boat sailed 
about 18 years ago.


> Even worse, people may not realize that they *need* to upgrade their 
> libraries, because consumers silently correct the errors. So this will 
> *cause* broken content to appear in the wild.

Yup, for a few years each time a new void element is introduced, there is 
pain.

We have to balance this against the benefits of a cleaner language. For 
example, the <command> element in HTML5 would be basically unusable if it 
had to be writen as <command></command>.

The same problem exists with new elements with optional tags (like <rp> 
or <rt>), and with new elements that are not phrasing elements, like 
<section>. This is the price we pay for HTML not having been written with 
forward-compatibility in mind. It's not a huge deal.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 30 December 2008 13:47:39 UTC