Commit 2bf8f4d
committed
fmt: automatically remove self-closing slash from void elements
Non-void elements will not be automatically fixed and the error will
remain for the user to see. One reason for this behavior is to make
sure we don't "sneakily" remove a self-closing tag from an element that
was hiding a nesting error. By having the user face the problem they
get a chance to discover the latent mistake and fix it, on top of
learning a bit more about html.
This is what I mean by latent nesting bug:
```
<body>
<div />
<div>
</body>
```
The indentation of this code seems to suggest that the two divs are
sibling, while in reality the second one is a child of the first because
in HTML self-closing slashes are ignored.
As of today editors like VSCode will produce misleading indentation
in the presence of a self-closing slash, helping perpetuate mistakes.1 parent 936cd2f commit 2bf8f4d
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1303 | 1303 | | |
1304 | 1304 | | |
1305 | 1305 | | |
1306 | | - | |
| 1306 | + | |
1307 | 1307 | | |
1308 | 1308 | | |
1309 | 1309 | | |
| |||
0 commit comments