5 ms·
The thing I hate about HTML (2010)
- dadrian 12y agoOf all the things to complain about HTML and modern web development, this ranks pretty low on my list.
- pcunite 12y agoAfter years of working with C++ GUI (Borland VCL's version) I'm loving HTML5 and how the controls layout so nicely.
- moron4hire 12y agoThat 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?
- austenallred 12y agoSaying 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 12y agoHah, but aren't most HTML documents a mess of </div></div></div></div> at some point :)
- icantthinkofone 12y agoNot when you know what you're doing and don't use auto code generators.
- mrits 12y agoAre you really on hackernews bragging about HTML skills?
- luchadorvader 12y agoBragging? I don't think s/he is bragging, but just saying that html can be done wrong.
- lfowles 12y agoWhat 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 12y agoIndenting all of the tags would help, but that's probably about it. <div> <footer> </footer> </div>
- TylerE 12y agoIn theory, maybe. In practice, where the code is coming from 3 or 4 different levels of templating? Bets are off.
- krapp 12y agoI 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.
- ely-s 12y agoThe only use for this I can think of would be to make it take less characters.
- simplicio 12y agowhich is good, because I keep running out. :)
- krapp 12y agoIt solves a problem which vexes many Lisp programmers, which is the existence of data structures and languages which are not lispy.
- minikomi 12y agoEditing structures like this using paredit is quite easy and fun though - once you're over the hump.
- buckbova 12y agoJade does this elegantly. http://jade-lang.com http://jade-lang.com
- arvinsim 12y agoIt's just so refreshing not having to type closing tags(Emmet aside).
- currysausage 12y ago> 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-tags https://html.spec.whatwg.org/multipage/syntax.html#optional-... > </> This reminds me of @annevk's XML5 concept: https://annevankesteren.nl/2007/10/xml5 https://annevankesteren.nl/2007/10/xml5
- mikeash 12y ago"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 12y ago> "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?
- manigandham 12y agoThis is such a trivial complaint and breaks readability/usability for no real advantages.
- tayk 12y agoSuch a bummer there's nothing out there that solves this. Oh wait, slim, haml, PHamlP, shpaml...
- kylec 12y agoThe 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 12y agoInvalid 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 12y agoYou'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 12y agoSo don't tell the truth? It's interesting that people on Hacker News are intimidated so easily when confronted with such things.
- WorldWideWayne 12y agoNo, 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.
- 12y ago
- smizell 12y agoHiccup gives you HTML in Lisp https://github.com/weavejester/hiccup https://github.com/weavejester/hiccup
- endgame 12y ago(2010)
- deleted 12y ago[deleted]
- icantthinkofone 12y agoYou are confused. HTML is used to describe the structure of the document, not its visuals. CSS has nothing to do with the HTML content so your complaint about the property/value thing is misplaced and inlining CSS, as you show, is frowned upon. Then you show the tag/tag thing as if that is a HTML pattern but what you show as your example is just gobbldey-gook nonsense and you claim it's typical. I just don't know what to say to you.
- ericfontaine 12y agohow 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)
- icantthinkofone 12y agoBecause whitespace matters in HTML.
- ericfontaine 12y agogood point, but could you elaborate?
- icantthinkofone 12y agoOne quick example. Certain elements are, or can be made to be, "inline" which gets them treated the same as characters on a line. Thus those elements, such as an image, will have white space between them as a word does in a paragraph. If you butt those element's tags right next to each other, with no white space between them, then there will be no white space on the displayed page.
- TheAceOfHearts 12y agoThis 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 12y agointeresting. Very clean looking.
- jaredmcateer 12y agoYou absolutely have to split jade documents and use includes/blocks though, any decent sized page, even if it's static becomes unmanageable very quickly.
- icantthinkofone 12y agoComplaints 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 12y agoIs HTML5+CSS3 not fully turing complete though?
- icantthinkofone 12y agoQuit reading stupid articles written by out-of-work people with nothing better to do.
- amichal 12y agohttp://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.
- schrodinger 12y agoNot a fan of how this blog takes over the swipe from screen edge gesture so I can't go back in Safari easily.
- fuzionmonkey 12y agoSee: https://github.com/dominictarr/hyperscript https://github.com/dominictarr/hyperscript
- shaunrussell 12y agol2haml
- SigmundA 12y agoI 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 12y agoThe 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.
- autokad 12y agoi 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 12y agoYour <b>opinion <i>is</b> incorrect</i>
- anh79 12y ago10 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
- jlward4th 12y agoThe thing I hate about bikeshedding
- tanami 12y agosee also: http://www.schnada.de/grapt/eriknaggum-xmlrant.html http://www.schnada.de/grapt/eriknaggum-xmlrant.html
- bbcbasic 12y agoTwo easy solutions: 1. HAML 2. IDE
- underwater 12y agoSGML has null end tags, which do exactly what he wants. For example this is valid: <p /Hello World/
- pbreit 12y agoThis 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.
- oliwarner 12y agoBrowsers 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.
- akater 12y agoEverything should be S-expressions, not just HTML.