I feel it’s better to write code using pure functions whenever possible to help prevent side effects
Thanks for the thoughtful reply.
Josh Habdas

I would agree at this one. Functions do help prevent side effects, but that would be re-writing the whole idea of inheriting the behaviors of HTMLElement itself.

Besides, the idea of writing functions was just to return the HTML template for a particular pseudo-element (written in function form) given properties that may or may not be manipulated for viewing and interactive purposes.

In WC, it is the same, you just set in your shadowDom the template and it will do the same. Add some helper lib to process the function to inherit HTMLElement and you are set.

As for Polymer, I think it is better because you write the template in HTML format (and not as a string) and Polymer does the binding of that template written in HTML to your extended HTMLElement object, effectively creating a new reusable HTML element. And if we are really strict on not using classes as a way to program these, then we just use a small helper library to do that (with some perf cost but I hope it is not significant).