Skip to content

Order of execution for events? #13105

Mar 26, 2025 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Thanks for raising this interesting observation! After investigating, here's what I found:

  1. Order Stability: The execution order of events follows their definition order in the template. This behavior comes from:

    • The compiler preserves attribute order during parsing
    • Events are compiled to an array maintaining this order: Playground (visible in the playground's JS tab)
    • The runtime executes handlers in array order
  2. Implementation Status:

    • This behavior has been stable for years
    • While not explicitly documented, it's implicitly guaranteed by the consistent implementation
    • No known plans to change this behavior
  3. Recommendations:

    • Generally safe to rely on this order
    • For critical cases:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@slbayer
Comment options

Answer selected by slbayer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants