Thursday, July 15, 2010

The thing I hate about HTML

Is end tags. They are the source of HTML evil.

Consider this:

<div class="red">
<p>
Hello, World!
</p>
</div>

Now, ask yourself: do we really need the end tags to say what they are ending? I mean, what's the difference with this?

<div class="red">
<p>
Hello, World!
</>
</>

The problem with having named end tags and browsers that are kind to bad developers is that it lets you do something like this and get away with it. The browser magically says: "Oh, he must have meant to close that <p> tag so I'll do it for him.

<div class="red">
<p>
Hello, World!
</div>

HTML really ought to look like this:

(div class="red"
(p
(Hello, World!)
)
)

Given that the tags are meant to be balanced there's no reason to force the author to figure out which tags they want to balance and force them to write it down. It adds nothing. If they get the balancing wrong then they should be punished for it and clean up the page. Writing nice end tags is busy work that satisfies the mediocre. Without them we'd have nice, parseable pages.

But what do I know, I think LISP is cool.

PS Yes, I know there are some tags that don't need end tags (e.g. <img>). But that's just messed up. Also, <p/> would simply be (p) in my scheme.

PPS Since people were bitching about me using font and center tags I've changed them.

Labels:

If you enjoyed this blog post, you might enjoy my travel book for people interested in science and technology: The Geek Atlas. Signed copies of The Geek Atlas are available.

<$BlogCommentBody$>

<$BlogCommentDateTime$> <$BlogCommentDeleteIcon$>

Post a Comment

Links to this post:

<$BlogBacklinkControl$> <$BlogBacklinkTitle$> <$BlogBacklinkDeleteIcon$>
<$BlogBacklinkSnippet$>
Create a Link

<< Home