Skip to content

Commit a662aa2

Browse files
committed
update readme
1 parent 12d6eb3 commit a662aa2

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,48 @@ As far as I'm concerned, there is no good reason to forbid `<style>` in body, bu
215215

216216
Related upstream issue: https://github.com/whatwg/html/issues/1605
217217

218-
218+
### Why does SuperHTML consider unclosed `<li>` elements an error?
219+
220+
According to the HTML spec it's legal to leave some tags unclosed.
221+
One common example is `<li>`, which enables this usage pattern:
222+
223+
```html
224+
<ul>
225+
<li> First point
226+
<li> Second point
227+
</ul>
228+
```
229+
230+
The reason why this is not ambiguous is that `<li>`cannot be nested inside
231+
another `<li>` so whe the second sibling is encountered, it's possible to always
232+
correctly implicitly close the first `<li>`.
233+
234+
SuperHTML breaks compatibility with the HTML spec in this regard for one main reason:
235+
while implicitly closed tags are unambiguous in *valid* HTML documents, it creates a
236+
problematic gray area when it comes to typos.
237+
238+
Consider the following snippet:
239+
240+
```html
241+
<li>first point<li>
242+
```
243+
244+
If SuperHTML were to follow the HTML spec it would have to consider this valid
245+
HTML that represents two bullet points, the second of which contains no content.
246+
247+
Unfortunately it's also very likely (acutally even more so) that the user just
248+
forgot the closing slash in the second tag.
249+
250+
For this reason SuperHTML does not allow closing tags implicitly even if the
251+
HTML spec allows it.
252+
253+
If you want to write HTML code that leverages this feature, do not use SuperHTML
254+
as there are no plans to ever support it.
255+
256+
#### But what about Google AMP?
257+
Why are you letting an ad company decide what the world wide web should look like.
258+
Do you want ads? Because that's how you get ads.
259+
219260
## Templating Language Library
220261
SuperHTML is also a HTML templating language. More on that soon.
221262

0 commit comments

Comments
 (0)