My approach to HTML web components

You can use any attributes you want on a web component…I’m a little nervous about this. What if HTML ends up with a new global attribute in the future that clashes with something I’ve invented? It’s unlikely but it still makes me wary.

So I use data- attributes…[and] the browser gives me automatic reflection of the value in the dataset property.

Wait, what? Why am I not doing this?

Instead of getting a value with this.getAttribute('maximum') I get to use this.dataset.maximum. Nice and neat.

Smart.