3 ms·
A tag could be closed without repeating it's name. It's obvious from the DOM which tag is being closed. It's the job of code editors to help you out by matching
by andybak 13y ago
A tag could be closed without repeating it's name. It's obvious from the DOM which tag is being closed. It's the job of code editors to help you out by matching start/close tags - not the job of the language.
By the way - no semi-colons in javascript was a good idea aside from a few major factor - it broke things and it was a hack based on loose syntax handling. If it was built into the language design then it would have been a good thing.
- talmand 13y agoBut closing a tag with its name makes it clear to the person writing the code what's being closed. Think of a div that contains, say, a hundred lines of HTML. There's a habit with some people to insert a comment at the closing div to identify which div is being closed by referring to its id. What you propose is trivial to the machine, but not necessarily easier for the human. By the simple fact that no semi-colons broke things and was a hack contradicts the thought that it was a good idea. Building it into the language might be a good idea but it wasn't to try to go around the language.