logoalt Hacker News

ok123456today at 3:12 AM2 repliesview on HN

By default, they will behave like spans.

You can customize it using the Custom Element API: https://developer.mozilla.org/en-US/docs/Web/API/Web_compone...


Replies

loftiestoday at 4:36 AM

I used custom elements extensively in 2014 when support was not as widespread. I think it's a beautiful, elegant solution and I'm still a little bit bitter that React became as big as it was. Now everything "has" to be a SPA because developers want to use React, whereas most users would actually be better served with good 'ol HTML with some custom elements where needed.

show 3 replies
zikani_03today at 8:43 AM

I would rather use semantic elements for the examples like the one in the article and use web components/custom elements where appropriate.

Web Components are underrated for sure. I had a need for a custom element[0] and it was not difficult to implement.

[0]: https://github.com/zikani03/hypalink