W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2010

[whatwg] self-closing tags in html5

From: Kornel Lesiński <kornel@geekhood.net>
Date: Fri, 31 Dec 2010 16:33:40 -0000
Message-ID: <op.vok6yfgyte2ec8@aimac.local>
On Fri, 31 Dec 2010 07:18:52 -0000, Ian Hickson <ian at hixie.ch> wrote:

> For example, markup such as the following is sadly common:
>    <p/>Hello world!</p>
> I have therefore not changed the spec in response to this request.

I've checked www.dotnetdotcom.org dataset looking for <tag?/>?</tag>,  
excluding <script> and comments.

You're right about HTML elements ? constructs such as <br/></br>, <a  
href=/></a> and <div/></div> are common (7% of pages have at least one  
such construct!), and almost every HTML element is misused like this (even  
<body/>, <style/>, <b/>).

However, for non-HTML elements the story is completely different.

There are very few pages (< 0.01%) that have this error on non-HTML  
elements. I've found few cases of <personname productid="???" w:st="on"  
/>???</personname /> and <Actinic:COOKIECHECK/></Actinic:COOKIECHECK/>,  
which don't seem to be used on client-side anyway.

Parsing of non-HTML elements is not interoperable between IE and non-IE  
browsers. IE already supports self-closing syntax on prefixed elements,  
but other browsers don't:


and IE cannot properly parse unknown non-prefixed elements, except when  
(relatively new) workaround is used (http://ejohn.org/blog/html5-shiv):


With such interoperability problems, I think it's unlikely that there are  
many pages that rely on particular parsing of non-HTML elements,  
especially one that disagrees with XML.

I think HTML5 can specify that a fixed set of old HTML elements has to be  
closed according to HTML rules, but all other elements support  
self-closing syntax like XML.

regards, Kornel Lesi?ski
Received on Friday, 31 December 2010 08:33:40 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:29 UTC