|
|
|
|
|
by naniwaduni
2236 days ago
|
|
This actually produces the DOM equivalent to <div> <p> </p><h1> </h1><h2> </h2></div>. 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... |
|
For example, <p>A<p>B</p>C</p> looks like two nested <p> but it is parsed as 3<p> next to each other: <p>A</p><p>B</p>C<p></p>.