News for hackers. Stuff that matters.
Re:The HTML5 Parsing Algorithm by jimmyjazz14 on Thursday August 05, 2010 @09:07PM (#1579863)
I would prefer that the parser just failed when invalid code was encountered, personally I saw this as a strong point of XHTML.
Re:The HTML5 Parsing Algorithm by ugh on Thursday August 05, 2010 @09:28PM (#1579911)
One of the nice things about the web is that all websites still work. Here is the first webpage: http://www.w3.org/History/19921103-hypertext/hypertext/WWW/T... That one wouldn’t work with a strict parser (look at the source: it uses the header tag instead of the head tag).

Breaking half or more of all the websites out there wouldn’t exactly be what I would call the “spirit of the www”.

Re:The HTML5 Parsing Algorithm by tedunangst on Thursday August 05, 2010 @09:53PM (#1579961)
Use a new parser for new pages, the old parser for old pages. The introduction of H.264 didn't suddenly render all older formats unplayable. Why can't a new markup format coexist with older formats, too?
Re:The HTML5 Parsing Algorithm by ugh on Thursday August 05, 2010 @10:18PM (#1579998)
What would be the advantage of that? Also, you then never truly can ditch the old parser if you want to keep everything working. Your browser has to come with two parsers for all eternity.
Re:The HTML5 Parsing Algorithm by philwelch on Friday August 06, 2010 @01:25AM (#1580295)
How many codecs does your media player come with?
Re:The HTML5 Parsing Algorithm by ugh on Friday August 06, 2010 @02:04AM (#1580341)
Not enough because there always seems to be this one file it absolutely cannot play ;)

It’s possible to do it but it’s also needlessly complex while giving you very little in return. The biggest, most problematic flaw of allowing browsers to parse invalid code, namely that different browsers might handle failure differently, is in the process of being fixed and that’s good enough, I think.

Strict parsing has been tried and it was a resounding failure. It’s not going to happen.

Re:The HTML5 Parsing Algorithm by wilhelm on Friday August 06, 2010 @01:38PM (#1581698)
Web browsers already have this, and it sucks. There's XML mode, HTML standards mode, HTML quirks mode and HTML almost standards mode. It's horrible to test and maintain.
Re:The HTML5 Parsing Algorithm by masklinn on Friday August 06, 2010 @01:09AM (#1580269)
1. How do you discriminate?

2. What would the point be, apart from annoying every single end user?

Re:The HTML5 Parsing Algorithm by jimmyjazz14 on Friday August 06, 2010 @01:46AM (#1580319)
Maybe a content-type header from the server? The point as I may wrongly see it is, that attempting to support backward compatibility indefinitely will result in overly complex and bloated browsers in the future.
Re:The HTML5 Parsing Algorithm by wilhelm on Friday August 06, 2010 @01:41PM (#1581705)
Nobody sets headers and meta information correctly anyway. Those headers cannot be trusted, and browsers have to guess what content-type and character encoding should actually apply to any particular document.
Re:The HTML5 Parsing Algorithm by haberman on Friday August 06, 2010 @02:53AM (#1580412)
You have to realize that what you are proposing is simply a bad idea, even if everything is trying to be pure and perfect:

http://diveintomark.org/archives/2004/01/14/thought_experime...

Re:The HTML5 Parsing Algorithm by jimmyjazz14 on Monday August 09, 2010 @01:07AM (#1587067)
I think that article may have seriously changed my mind.
Re:The HTML5 Parsing Algorithm by wilhelm on Friday August 06, 2010 @01:34PM (#1581687)
You can still write the HTML5 vocabulary as XHTML if you really want to. That's perfectly valid, and defined in the spec.

The HTML5 parsing algorithm is what the browser vendors want and need, however. Since HTML was never specified properly - not even in HTML4, where large areas were just undefined - HTML parsers have slowly evolved through trial and error. If big sites depend on a particular behaviour in a particular browser, other browsers have tried to be bug-compatible with that browser. Browsers that failed to do so have lost market share. If a browser decided to halt on encountering anything invalid would lose all of its users instantly, since the vast majority of documents are invalid.

Parsers have slowly converged towards each other, and the HTML5 algorithm is the compromise between them that breaks the last amount of content.

In other words, the goal of the HTML5 parsing spec was never to make something nice and clean. The goal was to define how to parse the unholy mess all you web developers out there have created during the past two decades. A clear spec, a good test suite and exactly identical behaviour between browsers is a benefit for everyone.

Re:The HTML5 Parsing Algorithm by eru on Friday August 06, 2010 @06:42PM (#1582545)
I agree. But: Why do we need exactly identical behaviour? Wasn't HTML intended to leave lots of discretion for rendering decisions to the browser?
Re:The HTML5 Parsing Algorithm by wilhelm on Saturday August 07, 2010 @07:56AM (#1583459)
If you parse a string of bytes, it's nice if it always turns into the same DOM. That's the scope of the HTML5 parser. There is no benefit to inconsistencies here.

Allowing browsers on different platforms to adjust page widths, font sizes, whether or not load images and plugins in accordance with the user's preferences is fine, but that's an entirely different issue.

Re:The HTML5 Parsing Algorithm by eru on Monday August 09, 2010 @09:16AM (#1587829)
Thanks for the clarification.
Re:The HTML5 Parsing Algorithm by benhoyt on Thursday August 05, 2010 @09:24PM (#1579900)
Hmmm. I suspect that would break 90% of web pages on the web. On the other hand, people would make their pages valid pretty quick. :-)
Re:The HTML5 Parsing Algorithm by wlievens on Friday August 06, 2010 @05:17AM (#1580602)
What about pages that are not maintained but still carry value?
Re:The HTML5 Parsing Algorithm by wilhelm on Saturday August 07, 2010 @07:58AM (#1583461)
No. Browsers that implemented this would just lose their market share instantly. Users prefer being able to use their favourite sites.