Performance: Section and article
Using semantic elements like <section> and <article> affects how browsers parse and render the page structure, impacting accessibility and rendering efficiency.
<section><article>Content</article></section>
<div><div><div>Content</div></div></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Nested <div> without semantics | High (deep nesting) | Multiple reflows if content changes | Moderate | [X] Bad |
| Using <section> and <article> | Low (shallow, semantic) | Minimal reflows | Low | [OK] Good |
<section>
<h2>News</h2>
<article>
<h3>Article 1</h3>
<p>Content of article 1.</p>
</article>
<article>
<h3>Article 2</h3>
<p>Content of article 2.</p>
</article>
</section><section>
<article>
<h2>Title</h3>
<p>Paragraph content.</p>
</article>
</section>Pass the test and this pattern moves unknown