Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 1.04 KB

no-element-event-actions.md

File metadata and controls

34 lines (22 loc) · 1.04 KB

no-element-event-actions

Using HTML element event properties such as onclick for Ember actions is not recommended for the following reasons:

  • It doesn't work for SVGs (since there is no onclick property of SVGElement).
  • It can lead to confusing and unexpected behavior when mixed with normal action usage. For a comprehensive explanation of why, read Deep Dive on Ember Events.

This rule forbids the following:

<button onclick={{action "submit"}}>Submit</button>

This rule allows the following:

<button {{action "submit"}}>Submit</button>
<button {{action "submit" on="doubleClick"}}>Submit On Double Click</button>

References

Related Rules