I'm not sure which phase of web component adoption this is, but this little bit of duct tape has been working wonders for me! 😊 #JavaScript #webdev
Post
calebhailey.comcustomElements.apply()A (naive?) alternative to customElements.define().
Thanks to @adactio.com, @jakelazaroff.com, and @cferdinandi.bsky.social for your many words on the topic of HTML Web Components. Please save me if this is a horrible idea! 😅
That first line just checks to make sure the component argument is a JS class. And yeah, I think this is maybe the first time I’ve ever extended a third-party object in this way. But it was such a small little hack I didn’t even give general "best practices" a very thorough consideration. 🤪
0 reposts0 likes
No replies yet.