|
|
|
|
|
by johncmouser
2232 days ago
|
|
they will be nested right. so <div>
<p>
<h1>
<h2>
without closing tabs create the DOM tree div->p->h1->h2if you were actually developing production code and misplaced, let's say, <p>'s closing tag, then that would mess up the rest of your tree (from your perspective -- the computer doesnt care) |
|
Many of the rules for unclosed tags are more there so that browsers can agree on what to do with garbage first, and for you to rely on only incidentally! They defer to historical practice before common sense!
In order to predict this reliably, you essentially need to have the list of content categories[1] memorized (or look them up). Not all of them are ... necessarily intuitive.
[1]: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Cont...