4 ms·
Technically, one of the reasons for closing tags is that HTML, like its SGML heritage, allows a non-tree structure, which means tags need not be closed in the o
by pmjordan 16y ago
Technically, one of the reasons for closing tags is that HTML, like its SGML heritage, allows a non-tree structure, which means tags need not be closed in the order they are opened, e.g.:
<b>bold only, <i>bold-italic,</b> italic only</i>
But that's so ridiculously rare in practice (and totally messes with things like DOM traversal) that nobody missed it in XHTML, which, like its XML ancestor, requires a pure tree structure. Yet XML still requires named end tags, and so does modern HTML.
You can of course generate HTML from S-expressions, most Lisps have libraries for it. I particularly like the Clojure notation of
['tagname {:attrname "attrvalue"} child-nodes...]
where {} denotes a map literal, but even if you use that, your client JavaScript deals with the emitted ugly HTML.
The biggest problem I have with HTML and CSS, though, is that they're both designed for marking up text, not websites. Divs and such are an afterthought.
Tangent: I failed trying to leave a comment on the blog proper. Some kind of internal error delivering the comment.
- baddox 16y agoIs that actually allowed? I remember my old HTML books when I was a kid said you couldn't do that.