Live data from Hacker News

Htmx 1.0.0 Release

htmx.org

61–62 of 62 posts

Re: Htmx 1.0.0 Release

#61
post #3

> It's worth mentioning that, if you prefer, you can use the `data-` prefix when using htmx I don't know why people who make frameworks either prefer invalid HTML, or if they do allow people to write valid HTML they seem to show the invalid code in the docs You are not allowed to invent any old attributes you want and add them to any element and have it be valid HTML, but you can invent any attribute you want so long…

But prepending with data can be annoying both from a "quickly reading" perspective, and an aesthetic one. The goal isn't to provide valid HTML necessarily but just allow the library to parse it correctly.

How does writing invalid HTML help toward the goal of correct parsing exactly? To me it would seem to open up an infinite variety of edge cases that simply don't need to exist if you're working with 100% standard code.

Re: Htmx 1.0.0 Release

#62
post #61

Earlier quoted context omitted.

But prepending with data can be annoying both from a "quickly reading" perspective, and an aesthetic one. The goal isn't to provide valid HTML necessarily but just allow the library to parse it correctly.

How does writing invalid HTML help toward the goal of correct parsing exactly? To me it would seem to open up an infinite variety of edge cases that simply don't need to exist if you're working with 100% standard code.

That assumes that HTMX wants to be fully compliant HTML code, which, by the author's optionality on data- vs non data- attributes, does not seem to be the case. This then is basically like JSX, it looks like HTML but isn't really, just syntactic sugar over structure, presentation, and logic operations.
Post reply on HN