Closed basham closed 5 years ago
OK, after going through the code, I've decided to keep the project as is, symmetric with CustomElementsRegistry where, once you define a selector behavior, it is possible to retrieve such defined behavior via regularElements.get(...)
which has no meaning in when-elements
library.
Accordingly, I think when-element
has different semantics and goals, so I'm OK in it having its own way of doing things, here I'll just try to keep consistency and symmetry with documented standard.
I hope that's OK, so that users will have choices 👋
Yes, I understand wanting to keep in symmetry with CustomElementsRegistry, and when-elements
is purposely different than that API. I'm glad we could clarify the goals of our respective projects.
regularElements
protects against multiple definitions using the same selector. This behavior does align with the behavior of Custom Elements, but it is limiting and perhaps unnecessarily so. Without such protections, it means multiple behaviors could be defined in different places, even if they affect the same set of elements. That could be helpful to isolate concerns and provide more flexibility for code organization.For reference, this is how
when-elements
behaves.