Performance: Data attributes
MEDIUM IMPACT
Using data attributes affects DOM size and JavaScript access speed, impacting interaction responsiveness.
<div data-info='{"info1":"value1","info2":"value2","info3":"value3"}'></div>
<div data-info1="value1" data-info2="value2" data-info3="value3" data-info4="value4" data-info5="value5"></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Many separate data attributes | Increases DOM size | No direct reflows but slows JS | Minimal paint impact | [X] Bad |
| Single JSON data attribute | Smaller DOM size | No reflows | Minimal paint impact | [OK] Good |