Hacker News new | past | comments | ask | show | jobs | submit login
View-Source Is Good? Discuss. (dojotoolkit.org)
18 points by bdfh42 on Jan 8, 2010 | hide | past | favorite | 7 comments

The power of view-source is multiplied when generous parsers forgive errors and render anyway. The value of a big internet is much greater than the value of a clean internet.

I've never done any web programming before, so this is an honest question:

Is HTML so complex that people honestly cannot be expected to write legal markup? Because, if the great majority of people who have made websites are perfectly capable of writing to-spec HTML, having a stricter parser really wouldn't reduce the size of the web in any significant way.

Update - it seemed a shame to leave so much typing in a nested comment, so I cleaned this up and posted it on my blog:

* http://quandyfactory.com/blog/39/the_virtue_of_forgiving_htm...

I also posted it to HN:

* http://news.ycombinator.com/item?id=1040169


> Is HTML so complex that people honestly cannot be expected to write legal markup?

If you're already a programmer, HTML syntax is easy enough to understand and produce in valid form.

However, most people who create web content aren't programmers - particularly during the early days of the internet when it grew exponentially and established the positive network efficiencies that ultimately dragged more professional developers onto that platform.

Rather, they were amateur enthusiasts exploring a new technological domain. Thanks to HTML, the number of people who could create web pages was vastly higher than the number of people who could write computer programs.

It was the rapid democratization of HTML made possible by forgiving parsers that accounts for much of its success as a language - and of the success of the internet as a platform.

When an HTML parser finds code so bad that it can't render it, the parser just skips it and moves to the next line, in the manner of VB's `on error resume next`. (Contrast the stricture of XML parsers, which fail on encountering malformed code and produce no output at all.)

Since HTML rendering in response to an HTTP GET request is essentially idempotent, there's no real harm in continuing to parse code after encountering an error - but the network effects from doing this are huge.

If only programmers possessed the arcane ability to produce well-formed, valid markup, it would never have experienced the early growth that transformed it into the reigning standard of a huge and growing public network.

Edit - one more thing: for many people, HTML provided a gently sloping pathway into programming for people who might otherwise never have managed to overcome the steep barriers to entry of, say, C or C++.

Many programmers today (myself included) found their way into programming from a start in HTML, after bumping into the limitations of static content, exploring event handling in javascript, and then making the jump over to PHP or classic ASP and thence to SQL - and ultimately over to more modern languages with more robust, structured software design principles baked into them than the spaghetti code that powered a lot of early dynamic websites.

Has anyone credibly argued that view-source should be removed from browsers? Or that we should move away from sending plain-text HTML and JavaScript [1] so that websites can hide their source code?

If not, then I'm not sure what the point of the piece is.

[1] I realize that many places obfuscate their JS source. But there is a significant step from that to advocating changing the web's infrastructure so that we send what are essentially binaries instead of plain-text source.

In the middle he says that view-source encourages incompatible renderers but doesn't support that position. I really don't see how that can be the case?

I think this is a pointless debate as it is simply impossible to disable the "view source" functionality due to the way HTTP/HTML work.

(Of course a browser can remove this functionality but that wouldn't stop other browsers from keeping it. Also, the DOM can be manipulated from javascript, sometimes this is taken to the extreme such as in GMail, but many modern browsers have DOM inspectors)

View-source is a great resource for learning html/js/css, but at the same time, I think the quality of references for html have improved. When view-source was the most critical - in the early years - there wasn't a site like w3schools is now to allow anyone to easily learn html syntax and rules.

It'd still be a horrible thing for the webdev community to lose/throw-away the ability to view the source of any site, but I don't think the effect would be quite as bad as it would have been ~20 years ago.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact