4 ms·
This already exists. They are called custom elements. https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements https://html.spec.whatwg.org/
by nidificate 7y ago
This already exists. They are called custom elements.
https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements https://html.spec.whatwg.org/multipage/custom-elements.html#...
https://github.com/w3c/webcomponents/ https://github.com/w3c/webcomponents/
https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements https://developer.mozilla.org/en-US/docs/Web/Web_Components/...
- tenaciousDaniel 7y agoYep, to some degree. Though what I would love in an xml-based UI description language is the ability to opt into default system behaviors, while maintaining the ability to use whatever semantic naming convention that fits my application. I wrote this code in another comment, but imagine if you could hook functionality to an element via defined attributes. With custom elements, you have to add the functionality via a script, and they aren't system functions (from what I can remember, I may be wrong). <LabelList list> <LabelItem label listItem> </LabelItem> </LabelList> In the above code: - the LabelList element hooks into the systems "list" behavior - the LabelItem element hooks into the systems "label" behavior - the LabelItem element hooks into the systems "listItem" behavior
- warp 7y agoMaybe the is="" attribute gets you partway there? <ul is="label-list"> <li is="list-item">foo</li> </ul> EDIT: google's documentation: https://developers.google.com/web/fundamentals/web-components/customelements#extendhtml https://developers.google.com/web/fundamentals/web-component...