[Home] [By Thread] [By Date] [Recent Entries]

  • From: James Clark <jjc@j...>
  • To: "xml-dev@l... List" <xml-dev@l...>
  • Date: Wed, 15 Dec 2010 16:32:41 +0700

On Tue, Dec 14, 2010 at 10:27 AM, James Clark <jjc@j...> wrote:
  We have two distinct cases:

(a) Allowing something like <br></br>

(b) Allowing something like <a/>

For (a), wouldn't existing parsers simply ignore the end-tag?

It turns out that they do not.  HTML5 says that the error recovery for

<br></br>

is to treat it as

<br><br>

(I find this bizarre in the extreme.) The spec is hard to read but you can see it in

http://dev.w3.org/html5/spec/tokenization.html#parsing-main-inbody

An end tag whose tag name is "br"
Parse error. Act as if a start tag token with the tag name "br" had been seen. Ignore the end tag token.

There is a handy tool for seeing how the HTML5 spec recovers from errors:

http://software.hixie.ch/utilities/js/live-dom-viewer/

James

  • Follow-Ups:

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member