This is another project that teaches you to write non-standard, invalid code, with the hopes that a tool will come along and transform it into valid, standard code later.
And there's no need, because there are multiple ways in HTML they could already express this without violating HTML. Here are 2 ways that work, and then the way they've done it which is in violation:
Possible method 1: Data attributes. Any time you as an author want to add additional data to an element, you are free to invent any custom attribute names you want, so long as they begin with "data-".
Possible method 2: Custom elements. Any time you as an author want to add a custom element to HTML, you are free to invent any tag name so long as it follows a simple naming criteria (essentially [a-z]+-[a-z]+) and if you invent any custom element, you are allowed to define whatever attributes on it you like.
Invalid method chosen: To pollute standard elements with invalid attribute names in violation of the HTML standard.
> Possible method 1: Data attributes. Any time you as an author want to add additional data to an element, you are free to invent any custom attribute names you want, so long as they begin with "data-".
From the linked docs:
> It's worth mentioning that, if you prefer, you can use the data- prefix when using htmx:
Given the documentation actually list the data-* syntax as an alternative (and pretty much near the top), I’m assuming they are aware of the problem, but still prefer the non-standard-compliant attributes.
And there's no need, because there are multiple ways in HTML they could already express this without violating HTML. Here are 2 ways that work, and then the way they've done it which is in violation:
Possible method 1: Data attributes. Any time you as an author want to add additional data to an element, you are free to invent any custom attribute names you want, so long as they begin with "data-".
Possible method 2: Custom elements. Any time you as an author want to add a custom element to HTML, you are free to invent any tag name so long as it follows a simple naming criteria (essentially [a-z]+-[a-z]+) and if you invent any custom element, you are allowed to define whatever attributes on it you like.
Invalid method chosen: To pollute standard elements with invalid attribute names in violation of the HTML standard.