
The thing I hate about HTML (2010) - jgrahamc
http://blog.jgc.org/2010/07/thing-i-hate-about-html.html
======
austenallred
Saying we should write HTML using the following syntax?:

(div class="red"

    
    
      (p
    
        (Hello, World!)
    
      )
    

)

I'm not sure what problem this solves. It eliminates the tiny bit of work that
is typing the extra characters in a closing tag, and in doing so you lose all
of the other information as to what exactly you're trying to close. The end of
most HTML douments would be ))))))) (plus a mess of indenting).

I can see this causing many more problems than it would solve; I'm okay with
typing three extra characters to avoid lack of confusion.

The current syntax may not be ideal, but I don't think removing the object
type from a closing tab is a good way to make it better.

~~~
lfowles
Hah, but aren't most HTML documents a mess of </div></div></div></div> at some
point :)

~~~
icantthinkofone
Not when you know what you're doing and don't use auto code generators.

~~~
lfowles
What is "knowing what you're doing?" I'm honestly curious, because I handwrote
most of the HTML on my website and I don't know how to have it cleaner than
something like this:

    
    
      </div> <!-- footer -->
      </footer>
      </div> <!-- row -->
      </div> <!-- container -->
      

(If you actually look at the website, it will be pretty obvious that I'm no
skilled web dev)

~~~
krapp
Indenting all of the tags would help, but that's probably about it.

    
    
        <div>
           <footer>
           </footer>
        </div>

~~~
TylerE
In theory, maybe.

In practice, where the code is coming from 3 or 4 different levels of
templating? Bets are off.

~~~
krapp
I use Twig for templating a lot, and I have to admit that while I indent per
template, i don't even bother keeping track between parent and child.

But then, Twig has its own weird issues sometimes with adding whitespace so
I've given up caring how templated html works altogether in that case.

------
SigmundA
I thought I remember reading this was debated extensively when XML was being
ratified. The consensus was that it was better for reading the markup even
though it made it harder to write vs SGML's empty end tag.

In any non trivial HTML doc many of the close tags will be far from the start
tag, such as <body></body> and looking at a bunch of </> tags and having to go
match them up with the correct start tags is more difficult. I run into this
all the time with parentheses in your typical programming languages.

The IDE I usually use does auto close tags but also does folding both help
with verbose close tags or matching parens so it doesn't matter much what the
language does anymore. I generally do think html/xml is more readable because
it so verbose including end tags.

~~~
moron4hire
The reason this is a problem is not because documents are long, but because
HTML does not have a concept of encapsulation. You can't make a subroutine--or
rather, subtree--of HTML.

------
dadrian
Of all the things to complain about HTML and modern web development, this
ranks pretty low on my list.

------
kylec
The fact that the end tags are named means that people are also tempted to
write markup like:

    
    
        <strong> one <em> two </strong> three </em>
    

This is technically invalid, but some browsers will "helpfully" parse it and
apply strength to "one", strength and emphasis to "two" and emphasis to
"three". This would be avoided if the closing tag weren't named.

~~~
icantthinkofone
Invalid markup means you are relying on the browser to read your intent or
your mind. They are very good at doing that but no self-respecting web
developer would ever do such an insane thing as your example.

EDIT: Interesting about the downvotes. It shows a total lack of understanding
the fundamentals of how browsers work but, alas, downvote away.

~~~
adventured
You're being downvoted because of your argument from intimidation ("no self-
respecting web developer...") and your wording ("such an insane thing"), not
due to a lack of understanding browsers.

~~~
icantthinkofone
So don't tell the truth? It's interesting that people on Hacker News are
intimidated so easily when confronted with such things.

~~~
WorldWideWayne
No, tell the truth - just don't be a fucking asshole about it. Everything
about the way you're talking makes you sound like an aggressive jerk. Even
your username screams "I'm an asshole who thinks he knows it all and always
has a snarky reply ready". It's OK. We've all been there. Exercise is a good
way to get the negativity out.

~~~
icantthinkofone
"I can't think of one" as a username screams "asshole who thinks he knows it
all"? Wow. You should hear my thoughts now.

------
buckbova
Jade does this elegantly.

[http://jade-lang.com](http://jade-lang.com)

~~~
arvinsim
It's just so refreshing not having to type closing tags(Emmet aside).

------
smizell
Hiccup gives you HTML in Lisp
[https://github.com/weavejester/hiccup](https://github.com/weavejester/hiccup)

------
ericfontaine
how about just use whitespace, like python:

    
    
      div class="red"
        p
          Hello, World!
    

(of course I know would not look nice if had to place <b>tags</b> inside of
single line of text, and might get a little too indenty)

~~~
TheAceOfHearts
This is basically jade[0]. Although jade isn't quite as smart, so the
expression you wrote would be considered invalid.

[0] jade-lang.com

~~~
ericfontaine
interesting. Very clean looking.

~~~
jaredmcateer
You absolutely have to split jade documents and use includes/blocks though,
any decent sized page, even if it's static becomes unmanageable very quickly.

------
amichal
[http://en.m.wikipedia.org/wiki/Rich_Text_Format](http://en.m.wikipedia.org/wiki/Rich_Text_Format)
from 1987 ish worked this way. Or as another commenter mentioned SGML in it's
more compact forms from the same time period and so therefore early HTMLs.
Having a closing symbol at all is a pain and I have painful memories from
trying to manually find a missing closing bracket in a book length Rtf
document. HAML uses significant indention to accomplish the nesting which I
find much much easier to read nowadays.

------
oliwarner
Browsers are too kind to bad developers (who accidentally omit close tags) but
I don't see that changing those to parenthesis or whitespace will make those
developers any less rubbish.

The simple fact is: if you're still regularly typing your close tags in 2015,
you either need a better editor or you need to learn how to use your current
one better.

------
underwater
SGML has null end tags, which do exactly what he wants. For example this is
valid:

    
    
       <p /Hello World/

------
anh79
10 years ago I was a heavy TeX user and really hate HTML. I made it a little
fun with my stupid flex program
[https://github.com/icy/ktml](https://github.com/icy/ktml) :D

------
pbreit
This is such an odd rant from a very smart guy. Closing tags make plenty of
sense and from our web experience definitively are not a problem. The proposed
improvement seems far worse.

------
currysausage
_> PS Yes, I know there are some tags that don't need end tags (e.g. <img>)_

e.g. <p>, <li>, <tr>, <td>.

 _> But that's just messed up._

Nah, it's pretty straightforward once you wrap your head around it:
[https://html.spec.whatwg.org/multipage/syntax.html#optional-...](https://html.spec.whatwg.org/multipage/syntax.html#optional-
tags)

 _> </>_

This reminds me of @annevk's XML5 concept:
[https://annevankesteren.nl/2007/10/xml5](https://annevankesteren.nl/2007/10/xml5)

~~~
mikeash
"A p element's end tag may be omitted if the p element is immediately followed
by an address, article, aside, blockquote, details, div, dl, fieldset,
figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr,
main, menu, nav, ol, p, pre, section, table, or ul, element, or if there is no
more content in the parent element and the parent element is an HTML element
that is not an a, audio, del, ins, map, noscript, or video element."

Quite straightforward indeed.

~~~
currysausage
_> "A p element's end tag may be omitted..._

practically always except when it obviously makes no sense. If you mean
<p>Hello</p><span>World</span>, you obviously can't omit </p>, since the
inline <span> would become part of <p>. But why would you write that anyway?

When you omit </p> where you shouldn't, the validator will usually tell you.
You do validate your HTML, right?

------
fuzionmonkey
See:
[https://github.com/dominictarr/hyperscript](https://github.com/dominictarr/hyperscript)

------
pcunite
After years of working with C++ GUI (Borland VCL's version) I'm loving HTML5
and how the controls layout so nicely.

~~~
moron4hire
That is the rather depressing thing about this. The sorry state of HTML5 is an
indictment of the much more sorry state of every other cross-platform GUI
toolkit. When you start to break down all of the issues of development,
training, deployment, and execution, HTML5 is the better tool. It's by no
means a great tool, but what else do we have available?

------
autokad
i was actually thinking about this recently. one appeal of json over xml is
xml is so wasteful with all those tags. then i thought, why in the world are
we still doing web pages in html and not some other json or other syntax? =|

------
pikachu_is_cool
Your <b>opinion <i>is</b> incorrect</i>

------
tanami
see also: [http://www.schnada.de/grapt/eriknaggum-
xmlrant.html](http://www.schnada.de/grapt/eriknaggum-xmlrant.html)

------
akater
_Everything_ should be S-expressions, not just HTML.

------
schrodinger
Not a fan of how this blog takes over the swipe from screen edge gesture so I
can't go back in Safari easily.

------
endgame
(2010)

------
manigandham
This is such a trivial complaint and breaks readability/usability for no real
advantages.

------
tayk
Such a bummer there's nothing out there that solves this. Oh wait, slim, haml,
PHamlP, shpaml...

------
bbcbasic
Two easy solutions:

1\. HAML

2\. IDE

------
shaunrussell
l2haml

------
jlward4th
The thing I hate about bikeshedding

------
icantthinkofone
Complaints such as his, and most of the comments so far below, show a total
lack of knowledge of the science and underpinnings behind the whole thing and
the only supported proof throughout is silly, invalid examples of markup no
one would ever use.

More laughable are the attempts at making HTML look like a programming
language, which it is not, and I'd bet that comes as news to many.

~~~
dylz
Is HTML5+CSS3 not fully turing complete though?

~~~
icantthinkofone
Quit reading stupid articles written by out-of-work people with nothing better
to do.

