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

The : in template event bindings is required or not #138

Closed
LastLeaf opened this issue Mar 13, 2024 · 2 comments
Closed

The : in template event bindings is required or not #138

LastLeaf opened this issue Mar 13, 2024 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@LastLeaf
Copy link
Member

This should be made clear in documentation.

@LastLeaf LastLeaf added the documentation Improvements or additions to documentation label Mar 13, 2024
@LastLeaf LastLeaf self-assigned this Mar 13, 2024
@LastLeaf
Copy link
Member Author

The legacy bindxxx syntax without : is only valid in these conditions.

  • For component tags, it is valid, but can be overrided by component properties. For example:

    <my-component bindtap="func" />

    This will be treated as bind:tap , unless bindtap is a component property of my-component .

  • For native node tags, it is valid only when fallbackListenerOnNativeNode is set in the user's template configuration. This configuration can be set like this:

    Component({ template: { fallbackListenerOnNativeNode: true, /* compiled template body */ } })

    It is NOT recommanded since it disables any attribute names started with bind catch on .

  • Invalid on other tags.

@LastLeaf
Copy link
Member Author

LastLeaf commented Mar 15, 2024

It is recommanded that : should ALWAYS be added for event bindings. It makes code clear and results in better compilation results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant