Check out a free preview of the full The Good Parts of JavaScript and the Web course

The "How JavaScript Saved HTML" Lesson is part of the full, The Good Parts of JavaScript and the Web course featured in this preview video. Here's what you'd learn in this lesson:

HTML was not state-of-the-art technology when it was introduced no was it intended to be an application platform. Doug explains how HTML was only really meant for simple document retrieval and the arrival of CSS didn’t make things any better. There reason HTML and CSS didn’t die was because of JavaScript.


Transcript from the "How JavaScript Saved HTML" Lesson

>> [MUSIC]

>> Douglas: HTML was not state of the art when it was introduced in the late 20th century. It was intended for simple document viewers it was not intended to be an application delivery platform. We insisted on using it as an application delivery platform because we needed one and that was the best thing available, so we used it.

But it was not well suited to what we wanted to do. A lot of people looked at it in the beginning and thought it didn't have what it takes, and they were right. But we went ahead and did it anyway. So since then, the web standards were grown from a naive hypertext system under intense highly unstable competitive pressure.

As Netscape and Microsoft attempted to destroy each other by manipulating web standards and it wasn't designed to do all of this Ajax stuff. Its success is due to a lot of very clever people who found ways to make it work despite its design limitations. HTML was a huge improvement over SGML.

Primarily in that it was much a simpler anytime you take something that's too complex and turn into something it's simple, get generally are making it better. Unfortunately, they also made it more resilient. One of the rules in SGML was if you don't recognize the tag then total failure, nothing happens and they thought that was too much for the web.

So instead on the web, the rule is if you see a tag and you don't recognize it, ignore it and keep parsing and it works. And that's actually been good for the web because it meant that we could upgrade. We could have forward and backward compatibility because the browsers would be ignoring the differences as they enter and leave the standards.

Unfortunately the dark side of that is that there were, maybe still are, incompetent web masters who could not correctly write HTML. And the browsers would do heroic stuff to try to make sense out of the stuff that they are writing. Which turned into security exploits which we'll talk about on the third day.

So the original formation of HTML authors had virtually no control over presentation. And the thing didn't anticipate applications beyond simple document retrieval, which is a very small part of what we're doing now. It's not internally self-consistent. For example, it provides two ways of writing outlines one is nested one is not, it's not consistent.

And the thing that we call a web page is not a page, it's a scroll. I'm hoping someday we invent pages, cuz pages are great. Pages were a big step forward in the march of civilization, maybe someday the web will catch up to that. So the SGML community hated HTML, they thought it was an abomination.

They did not like the way it was simplified and even more than that they did not like the way it was so much more popular than SGML. So eventually they took over W3C and started changing things to be more to their liking. For example, they changed the way p worked, p had originally been a separator, they turned it into a container.

They started the thing about semantic markup which turned out to be a colossal waste of time and they also created the XML Fiasco. The idea was that they would create XML, which would be the successor of SGML. Which would be used as the new document format replacing HTML and be used as the world's data interchange format, it failed at both of those things.

HTML it turned out refused to die and it is still the web's document format and the world's data interchange format is Jason.
>> Speaker 2: But you said you can talk about mythical semantics.
>> Douglas: Not, I am not to be talking about semantic markup.
>> Speaker 2: Okay.
>> Douglas: You'll have to find someone else to tell about that.

>> Speaker 2: No, I'm curious as to why you.
>> Douglas: It didn't pay off, we spent a lot of time on it and didn't get anything for it.
>> Speaker 2: You know, the only folks that we run into that like it are people who have disabilities who want the semantic markup to provide some extra bit of information for them.

>> Douglas: I have a lot of sympathy for people with disabilities who are trying to use the web, I don't think that was the solution.
>> Douglas: But I can understand being desperate enough that compared to what the web delivers that anything else might look to be better than what you got.

I could talk about CSS, but I just start ranting and you don't need to hear me rant, do you? Anyways it's just, so it's talking to someone who's finally gotten good at CSS I mean it's hard to step up to CSS is really hard and difficult. Eventually designers get there and once they've done it this Stockholm thing seems to happen to them.

And it's kind of like watching a domestic dispute on cops. CSS isn't bad, you just don't understand it like I do, yeah, yeah, yeah. Anyway if all there was to the web was HTML and CSS, it would have been replaced by now. The web would be gone and we would be working on something else and this is the proof of that.

George Colony, the Chairman and CEO of Forrester Research was saying, Another software technology will come along and kill off the Web, just as it killed News, Gopher, et al. And that judgment day will arrive very soon, in the next two to three years. So he was predicting in 2000, that by 2003, the web would be dead, replaced by what he called the X Internet, which was an app that the executable Internet, it was an application delivery system.

That he thought that the web was deficient because all it could do was dispense documents and that is not what the world needed. This quote is no longer on the Forrester website.
>> Speaker 2: [LAUGH]
>> Douglas: has it though. You can go to, it's right there. So a lot of people heard this message, a lot of people believed it including Microsoft.

So when Netscape self destructed, Microsoft said good. We didn't want the web in the first place, so they disbanded the IE team and put them to work on the X Internet. So, they started up the dot net project, they put people on Avalon, they got moving on that stuff.

So, the surprise was that the web didn't die, and the reason it didn't die was because of JavaScript. That what Colony was arguing for correctly was that the world needed an application delivery system. The thing he didn't recognize was that the web already was one because JavaScript was in all the browsers.

Now Java community, remembers this differently. The Java community is really angry at JavaScript for being in the browser and thinks it's completely unfair that JavaScript was the language in the browser. Had Java been in the browser things would have been different, except that's not the way it was.

Java was the first language in the browser and Java applets failed. Java applets were the biggest failure in the history of software. A total out there in public, huge scale, flat on your face, the biggest failure we've ever seen in software was Java applets. They were supposed to write once and run everywhere and do everything and they didn't, total failure.

On the other hand, the browser is still in existence because JavaScript was there to save it. So a lot of people who used or everybody hates JavaScript. There are people who don't know JavaScript who hate it because they should know it. The people who do use JavaScript and hate it, actually hate the DOM.

The DOM is the API that the browser presents to JavaScript and it is one of the worst APIs ever invented. It's just really awful, it was designed also by Brendan Eich, he designed at the same week that he designed JavaScript.
>> Speaker 2: [LAUGH] Busy week.
>> Douglas: It was a busy week, he was handed Danny Goodman's HyperCard pile which is a book, that's two or three inches thick about HyperCard.

He never used HyperCard, never used a scripting system, very smart guy, very quick study. He read the book very quickly, and thought he got a sense of it, how do you apply the HyperCard model to the browser. And he came up with the DOM and it's just awful, it's just awful.

There have been many other people over the years who have improved it. For example one of the most important contributions was Scott Isaacs of Microsoft. He was on the IE 14 and he looked at the very peculiar model that Netscape had came up with, and normalized it in a really good way.

In the original Netscape model, not all elements were scriptable, and those that were scriptable were only scriptable in a way that matched what was in the HyperCard book. And as it said, let's make them all work the same way which made dumb programming significantly easier. But they never finished the reason they never finished was because Forrester said it's done.

So this is okay and they were all put on other projects and after IE6, it was just left and I was into the story. So they knew it wasn't finished they never intended to leave it at that state, it's just what was done. So they would often did other things, as a result it's incomplete API that's at the wrong level of abstraction that's just horrible to use.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now