News for hackers. Stuff that matters.
Re:Ways to make a web component by eeJah9to on Friday July 17, 2020 @01:33PM (#23873157)
You can, using the template element: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/te...

I tried that for webcomponents, but I found more to my taste to actually have everything in my javascript file rather than to jump between files (it's not that messy if you keep your components smalls).

Re:Ways to make a web component by Izkata on Friday July 17, 2020 @09:31PM (#23878139)
I experimented with this some years ago, building my own mini-framework for components. The main system provided a global hook that javascript within the template file could attach itself to, so everything for a single component did exist in a single file. So it is doable.

(I liked that part of my system, but I'd rewrite about half of it if I wanted to use it again)

Re:Ways to make a web component by clairity on Friday July 17, 2020 @02:02PM (#23873490)
neat, i remember running across that a while back, but promptly forgot about it. thanks for the reminder!