Delegate vs trigger
The Golden Rule
Understanding Event Delegation
What is Event Delegation?
How Aurelia's Delegate Works
<button click.delegate="handleClick()">Click me</button>
<button click.delegate="handleAnotherClick()">Click me too</button>Benefits of Delegation
When Delegate Works
Common Delegatable Events
Example: Multiple Buttons with Delegation
When to Use Trigger
Non-Bubbling Events
Common Non-Bubbling Events
Disabled Elements
Complex Button Content
iOS Click Events
Using Capture
When Capture is Useful
Capture Behavior
Performance Comparison
Memory Usage Example
Performance Best Practices
Event Object and preventDefault
Automatic preventDefault Behavior
Accessing the Event Object
Real-World Examples
Data Table with Row Actions
Media Player Controls
Form with Complex Validation
Troubleshooting Common Issues
Event Not Firing with Delegate
Event Firing Multiple Times
iOS Touch Events Not Working
Summary
Scenario
Recommended Command
Reason
Last updated
Was this helpful?