[whatwg] Closing tags for empty content model

Dean Edwards dean.edwards at gmail.com
Mon Sep 28 20:58:43 PDT 2009


On 29/09/2009 03:21, Tab Atkins Jr. wrote:
> On Mon, Sep 28, 2009 at 9:18 PM, Marius Gundersen<gundersen at gmail.com>  wrote:
>> Shouldn't you always close the tags, either self-closing or with a separate
>> close tag? That is, this is the correct way to do it:
>>
>> <video width="640" height="360" style="color:red">
>>   <source src="bunny.ogv" type="video/ogg" />
>>   <source src="bunny.mp4" type="video/mp4" />
>> </video>
>> <p>Text after the video element.</p>
>
> In the HTML syntax of HTML5, no, void elements do *not* have to be
> explicitly closed.  You *can* put the trailing slash on them, but it
> doesn't do or mean anything; it's simply ignored.
>

If the content is served as XHTML then it would have the same effect as 
adding the closing </source> tags. For a JavaScript solution I would 
like to avoid having to require XHTML. This is further complicated by a 
new discovery, Safari 3 completely ignores <source> elements. They don't 
appear in the DOM tree at all. But that's a separate problem. :)

It's probably too late to change the spec. But the Opera bug I pointed 
out is serious enough to consider an alternative solution. Allowing 
closing tags for <source> would solve the problem. I'm not sure of the 
implications for the defined rendering models in HTML5.

Just to reiterate, Opera<10 treats all unknown elements as container 
(flow) elements. That means that as soon as it encounters a <source> 
tag, all of the following elements are *children* of the <source> 
element. This makes all DOM queries and CSS rules completely useless. 
Allowing a closing </source> tag solves the problem.

-dean


More information about the whatwg mailing list