Hacker News new | ask | show | jobs
by raggi 1049 days ago
I use custom elements directly in a bunch of stuff I had roll and I find the composition and reuse advantage nice. I tend to not bother with template elements, they don’t help much. I also don’t bother with shadow dom or element styles, as again, until you are making a mess with a distributed team you don’t actually have css problems. css also got a lot better at not causing problems, with fancier selectors and less problematic layout models.

People say they’re slow, but things I’ve hand rolled this way, while none are super complex, I can make thousands of elements and not put a dent in any metrics or lighthouse runs. I tend to bind stuff I’m going to manipulate in the child tree to variables in the constructor, so I never really have the cost of constant lookups, which maybe amortizes well once you’re looking at whole program performance.