4 ms·
Web components are treated like HTML elements. You can nest and combine them with semantic elements and attach attributes to them. Say you have a component tha
by dgb23 3y ago
Web components are treated like HTML elements. You can nest and combine them with semantic elements and attach attributes to them.
Say you have a component that does something with titles (h1 etc.), then you would wrap the semantic element with a web component.
You do the same with buttons, text or input fields etc.
This way you 100% retain the semantic structure (before loading JS). And it’s possible to progressively enhance the DOM if that is a goal.