Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Custom element bindables take priority over custom attribute #1896

Closed
bigopon opened this issue Feb 2, 2024 · 0 comments · Fixed by #1897
Closed

[RFC] Custom element bindables take priority over custom attribute #1896

bigopon opened this issue Feb 2, 2024 · 0 comments · Fixed by #1897
Labels
RFC Request For Comment - Potential enhancement that needs discussion and/or requires experimentation
Milestone

Comments

@bigopon
Copy link
Member

bigopon commented Feb 2, 2024

🔦 Context

Suppose we have a global custom attribute size, and a custom element <square> with a bindable size property, and the following template:

<square size.bind="width">

Currently, in both v1 and v2, size.bind is understood as custom attribute size and thus the property size on the custom element <square> will be ignored. This will also lead to a different behavior when used in spreading ...$attrs.

This order of custom attribute taking over custom element bindable is not intuitive as it allows any arbitrary global custom attribute to override local element without anyway to overcome it, especially when consuming a 3rd party plugin. It also doesn't reflect common expectation of local first behavior.

In v2, we should change it so that custom element bindable will be of higher priority than custom attribute.

❔ Migration

Migration shouldn't be a big issue since it's unlikely that app will keep the conflict around.

cc @Sayan751 @fkleuver

@bigopon bigopon added the RFC Request For Comment - Potential enhancement that needs discussion and/or requires experimentation label Feb 2, 2024
@bigopon bigopon added this to the v2.0-rc milestone Feb 2, 2024
bigopon added a commit that referenced this issue Feb 3, 2024
…1897)

BREAKING CHANGE: custom attribute with the same name of a bindable on a custom element will be ignored.
[skip ci] Resolve #1896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Request For Comment - Potential enhancement that needs discussion and/or requires experimentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant