When creating a custom element like <input-field>, should custom attributes still use the 'data-' prefix or would it be acceptable to simply use them as-is? Basically using variation="abc" vs data-variation="abc" for example.
And if it is allowed, would re-using existing attributes like type be allowed?
In addition, would it be bad practice to add custom properties to the element's object during creation like the following:
class InputFieldElement extends HTMLElement {
constructor() {
super();
this.customProperty = {data: 123};
}
}
customElements.define('input-field', InputFieldElement);
I'm aware that these methods work perfectly fine right now, but the question is more if it's actually intended behavior or if it's just a weird edge-case that could stop working at any moment.
data-is a team decision.