4 ms·
I wish it didn't require authors to practice doing the wrong thing (writing invalid HTML) for to use the tool. Authors are free to either create any data-* att
by err4nt 2y ago
I wish it didn't require authors to practice doing the wrong thing (writing invalid HTML) for to use the tool.
Authors are free to either create any data-* attributes they wish for any purpose, so long as the custom attributes are prefixed with "data-".
Authors are also free to create any (valid) HTML custom element, and to invent custom attributes for those elements.
But this appears to require authors to write invalid HTML.
- zamalek 2y agoYou should be able to use qnames (foo:bar) for attributes, I think? The problem with data-* is that it's misuse, template directives aren't really data. E.g. something might actually use data-if, which would probably collide with a template directive.
- lowlighter 2y agoUsing qualified names is actually it good idea (similar to svg there could be a custom namespace for mizu) It'll kind of solve the previous commenter concerns about with writing invalid html. While namespaces are more a xml thing, there are probably many benefits to this approach like querying all attributes from the namespace at once too. I'll keep this in mind for future iterations!
- err4nt 2y agoThere's no way writing illegal HTML is preferable to writing legal HTML. Here's what the HTML spec[1] says about data-* attributes: Custom data attributes are intended to store custom data, state, annotations, and similar, private to the page or application, for which there are no more appropriate attributes or elements. Doesn't sound like this would be an abuse of even their specified intended purpose, sounds totally within the realm of why the feature exists in the first place: author-defined extensibility within the language. 1: https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes https://html.spec.whatwg.org/multipage/dom.html#embedding-cu...
- deleted 2y ago[deleted]