Re:HTML as a programming language – unifying HTML with Erlang
by amelius on Tuesday March 17, 2015 @07:04AM
(#9217200)
Totally agree. And actually, I find HTML in itself too verbose to begin with. Why require those close tags? So that one can see what tag is being closed? That is stupid, because in most cases, we're using just a few tags (DIV, SPAN) anyway, so this gives very little information. I'd rather use real open and close braces like most data-structures in modern programming languages.
[ Parent
| on HN ]
Re:HTML as a programming language – unifying HTML with Erlang
by talmand on Tuesday March 17, 2015 @09:48AM
(#9217837)
Sometimes seeing the closing tag is rather useful for the very reason you mention, to know which tag is closing. The simple fact that once it was popular to use a comment to identify the id or class of the closed element at the bottom of a long file suggests it's a problem to consider.
Re:HTML as a programming language – unifying HTML with Erlang
by amelius on Tuesday March 17, 2015 @12:41PM
(#9219183)
But nowadays, the behavior of an element can be completely styled by CSS. So in most code, you will find a lot of DIVs. And imagine having 10 DIVs nested: you can't possibly tell by looking at the closing DIVs which DIVs they are closing... Unless perhaps you put also the classname on the closing tag (which isn't allowed or enforced or verified). So, as you can see, the closing tag has very little utility. It only makes the code less readable (as it takes space). And also, but this is secondary, it requires more bandwidth.
Re:HTML as a programming language – unifying HTML with Erlang
by talmand on Tuesday March 17, 2015 @01:30PM
(#9219643)
Well, first I would say that if somebody has ten nested DIVs then they're doing it wrong. But if the DIVs are formatted properly then it's usually not that hard to find the matching start tag. As for the class in the closing tag, that's what my statement about people putting comments with the closing tag is referring to. It's been done and was quite popular at one time. I'm willing to bet our editing tools fixed that problem simply by highlighting matching element pairs.
But in the end, if HTML went with <div></> instead of <div></div> then I probably wouldn't mind so much. But I can't agree that no closing tag is more readable because it takes less space, that makes no sense. It might look better.
I would be curious about bandwidth savings but I'm willing to bet in most cases it would make very little difference.