Short closing HTML tags (the </> expanding)

Notice: This thread is very old.
Milo
Nette Core | 1283
+
+2
-

Latte macros can be short-ended. I mean {/} instead of {/some}. Imho, it is more readable in some cases.

And time to time, I'm thinking about short-ended HTML tags. Latte would expand them.

<table>
	<tr>
		<td>Something</>
		<td>Something</>
		<td>Something</>
	</tr>
</table>

It would be without BC. The only cons I can see, is the IDE support and highlighters.

So, should I start to think about pull-request?

David Grudl
Nette Core | 8201
+
+3
-

This seems even better and is va…wait-for-it…lid! :-)

<table>
	<tr>
		<td>Something
		<td>Something
		<td>Something
	</tr>
</table>

A lot of tags can be omitted:

</p> </li> </dt> </dd>
</td> </th> </tr>
<tbody> & </tbody> </thead> </tfoot>
</option> </optgroup> </caption>
<colgroup> & </colgroup>
<html> & </html>
<head> & </head>
<body> & </body>

And it IMHO covers the majority of use cases, where it would be appropriate to use </>.

Milo
Nette Core | 1283
+
0
-

Sure, sure :-) But, still it would be handy. E.g. easy to switch <div> to <p>.

<div>
	Very
	very
	very
	very
	very
	long
</>

Or inline is shorter:

Some <strong>important</> thing!

I'm thinking about it probably two years and I cannot recall more arguments for now. Time to time I hit it, and saying to myself: “That would be handy…”.

It's just idea.

David Grudl
Nette Core | 8201
+
0
-

I know that I replied to something little else. And I did not want to express that I am against. I am not.

Actually <strong>important</> is valid too, in HTML < 5 (see SHORTTAG YES and what it means).

(Btw, interesting is that <br/> in HTML 4 has special meaning which is very different from what is means in XHTML. So talks about compatibility between XHTML and HTML were never true.)

Jan Endel
Member | 1016
+
0
-

That ending can be handy, if it uses for n:macros:

<div n:if="$user->isLoggedIn()">Log out!</>