dom-size
Installation
SKILL.md
Reduce DOM size and complexity
An excessive DOM size increases memory usage, slows down style calculations, and makes layout reflows more expensive, leading to poor interaction performance.
Quick Reference
- Keep total DOM nodes below 1,500
- Avoid deep nesting (maximum depth < 32)
- Use virtualization for long lists of elements
Check
Check the total number of DOM nodes and the maximum DOM depth using Lighthouse or Chrome DevTools.
Fix
Simplify the HTML structure, remove unnecessary wrapper elements, and implement virtualization for large lists.