Hacker News new | ask | show | jobs
by xj9 4056 days ago
I use self-closing tags for aesthetic reasons, even though I know they aren't HTML. I like the consistency. I suppose I should get with the times, though, if I am to be taken seriously.
1 comments

Try doing <div/> or <script/> and you will see why it's a bad idea
Try doing a parser and you will see why self-closing void tags are generally a good idea.

Anyway, I don't understand this discussion at all. I was expecting something a bit better from the HN community. Since when did we start making strong judgments based on purely esthetical things?

An applicant to a position we offered once submitted a code without <head/> nor <body/> tags, and his justification was totally right: the standard doesn't actually require it[1]. So does that make you a bad programmer for using them? Not using them? I believe nobody really care, and I would have to be a really bad person to judge my colleagues based on that.

[1] http://www.w3.org/TR/2011/WD-html5-20110525/syntax.html#opti...

Those aren't void tags.

I've been working with web technologies for years and I happened to like a lot of things about XHTML. I know how the shit works, I just feel its more consistent to close all of your tags. You obviously wouldn't self-close a <div> or a <section> because those tags are supposed to have content!

As an aside, I would argue that <script> should be nullable when it has a src attribute.

Not a problem if you send it as application/xhtml+xml ;)