Re: [WICG/webcomponents] Proposal: Custom attributes for all elements, enhancements for more complex use cases (Issue #1029)

That was a fast turnaround....

There are a couple of things I like about this right off the bat:

* I like that this can be used to simplify attribute definition on custom elements.
* I like that this recognizes the problem of typing attributes and is even open to custom converters in the future.
* I like that this considers supporting a default value.
* I like that the programming model is pretty simple and harmonious with custom elements.

I agree on the need to hyphenate names, again matching the CE rules and the strict blocking of certain names altogether.

I need to think more about registration. That's the biggest open question for me. I think having registries on the individual types is interesting. I hadn't thought about doing it that way. I wonder how that will work with custom element registries, particularly WRT scoped registries. So, I wonder whether attribute registration should just be another API on the existing custom elements registry, so we can inherit all the work on scoping for attributes as well.

My personal preference...I don't particularly like using a "has" attribute vs. just using attribute names. It doesn't feel as "HTML-y" to me. That's not a deal breaker for me though.

I do think there should be a programmatic way to add and remove behaviors (and as a result, possibly callbacks for when that happens). I'm inspired a bit by Unity 3d, which has a generic scene graph with a behaviors system that is the mechanism for all node specialization. Behaviors are part of a collection and can be added, removed, searched, etc. This comes in handy if you want to build more complex systems of behaviors where one behavior looks for another and then if found, collaborates with it through its public API. You could imagine a custom drag/drop system working this way with custom attributes for draggables and drop targets, where the attributes locate one another and through their APIs coordinate the drag/drop.

Ok, that's just a few quick thoughts. I'm excited to see if we can make this happen!


-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1029#issuecomment-1718130179
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1029/1718130179@github.com>

Received on Wednesday, 13 September 2023 18:36:33 UTC