[whatwg] Empty elements

On Thu, 16 Feb 2006 00:49:15 +0100, Lachlan Hunt  
<lachlan.hunt at lachy.id.au> wrote:

> Tim Altman wrote:
>> On Wed, 15 Feb 2006 23:48:57 +0100, Ian Hickson <ian at hixie.ch> wrote:
>>
>>> On Wed, 15 Feb 2006, Tim Altman wrote:
>>>>
>>>> May OBJECT and CANVAS be treated as empty elements, i.e. <canvas />  
>>>> and
>>>> <object /> if there is no fallback content?

[...]

>>> If you mean "Can the string '<object/>' be treated as an empty element
>>> tag", the answer is no.
>>  You seem to have answered my question here.  Why not?
>
> Because it is XML syntax, not HTML syntax.
>
> According SGML rules, <foo/> has a different meaning from the same  
> syntax in XML.  According to the new HTML5 parsing rules (due to  
> complete lack of support for SGML), the '/' is an easy parse error and  
> is essentially ignored.  Backwards compatibility reasons prevent the XML  
> meaning from being retrofitted into HTML.

OK.  Assuming the HTML5 document is served with a text/html doctype, how  
would the following markup be parsed?

<table>
   <tr>
     <td>
       <canvas/>
       <p>Foo</p>
     </td>
   </tr>
</table>

If the '/' is an easy parse error, the p element becomes part of the  
fallback content for the canvas element.  But what about the end tags for  
td, tr, and table?

I skimmed the parsing section of the current HTML5 draft (mainly  
8.2.2.3.7) and noticed that the canvas element is being treated as a  
"phrasing" element.  Is this by mistake?  I would think it would be  
treated similar to the object element, since they have similar handling of  
fallback content.

-- 
Tim Altman

Received on Thursday, 16 February 2006 01:57:05 UTC