Performance: HTML rendering with {@html}
MEDIUM IMPACT
This affects how quickly the browser can render dynamic HTML content and impacts layout stability and interaction responsiveness.
<div>{#if safeHtml}<div>{@html safeHtml}</div>{/if}</div><div>{@html dynamicHtml}</div>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Direct {@html} injection without control | Inserts raw nodes dynamically | Multiple reflows if content changes | High paint cost due to layout shifts | [X] Bad |
| Conditional rendering with sanitized HTML | Controlled DOM insertion | Single or no reflows if stable | Lower paint cost with stable layout | [OK] Good |