Post

I love building custom elements but quickly end up with a deep DOM when keeping them small and nesting, also you often have to code with this nesting specifically in mind.

Custom attributes will be great for keeping things more composable. I’d estimate 8/10 custom elements I write could (and should) be custom attributes.

0 reposts1 like

For sure and also all these "data-something" attributes are so confusing. I can not remember projects where I used them at all. Every framework which uses them, struggle to gain popularity. And those who ignore recommendations and use their own attributes strive

Plus data attributes don't offer any API for lifecycle methods (like custom elements do, and custom attributes should), so you end up writing your own mutation observer which is no fun 🤢