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

> Hi @LeaVerou ,
> 
> I for one vote overwhelmingly to support svg (I was proposing that by extending "ElementEnhancement"), and I think it is up there in the top complaints / limitations for custom elements. So unless there's a solid reason not to, why wouldn't we?

I'm with you on that one!

> (mis)reading your proposal further (apologies in advance):
> 
> > Associating enhancements with a selector would probably afford maximum flexibility and allows the association to happen implicitly.
> 
> I'm getting a little lost here. Is your proposal heading in the direction of allowing each custom attribute to "opt-in" to be a behavior? 

You're right that as currently described, each custom attribute would be "opting-in", but also note that you could e.g. activate the behavior for the entire subtree the attribute is on (e.g. imagine a declarative version of Vue where the selector would be `[v-app], [v-app] *`.
However, in the spirit of making common things easy, I think it would make sense to define a default (if no selector is provided) that simply makes all specified attributes "activate" the behavior.
Note that this cannot be the *only* activation mechanism, as then attributes would be required (or imperative association).

> Is that why you are considering the "has" attribute? 

I'm listing two potential association schemes. I don't think we should go with `has`, for the reasons I listed.

> Is basing access to the name of the behavior based either literally on the custom attribute, or the camelCase string problematic?

Not 100% sure I fully understand what you're saying here, but perhaps the default I'm proposing above satisfies that?

> Either way, I'm not following some of the discussion (apologies, again), but have you yet settled on how third party vendors can access the behavior, what that looks like (and how to make that seamless), or is that a work in progress? 

Not 100% sure I understand what you're asking here either, but since these are regular objects (most likely classes, but I could see plain literals working too) you can just export them in the usual way. If that doesn't answer your question, I think some more specific use cases could help me understand it better.

> Are attributes required to enhance an element? If so, why?

No, they are not.

> Feel free not to answer, just wanted to convey what I'm looking for to be 100% satisfied, and what I'm finding difficult to follow.

This is great feedback on what I may not have explained sufficiently well, so please keep it coming!


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

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

Received on Thursday, 14 September 2023 17:15:32 UTC