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

Support custom Action Options #567

Merged
merged 2 commits into from Jul 28, 2022
Merged

Commits on Jul 28, 2022

  1. Support custom Action Options

    As a follow-up to [hotwired#535][] and
    [hotwired#546][], add support for declaring custom action
    modifiers in the same style as `:prevent`, `:stop`, and `:self`.
    
    Take, for example, the [toggle][] event. It's dispatched whenever a
    `<details>` element toggles either open or closed. If an application
    were able to declare a custom `open` modifier, it could choose to route
    `toggle` events denoted with `:open` _only_ when the `<details open>`.
    Inversely, they could choose to route `toggle` events denoted with
    `:!open` _only_ when the `<details>` does not have `[open]`.
    
    Similarly, the same kind of customization could apply to custom events.
    For example, the [turbo:submit-end][turbo-events] fires after a `<form>`
    element submits, but does not distinguish between success or failure. A
    `:success` modifier could skip events with an unsuccessful HTTP response
    code.
    
    [hotwired#535]: hotwired#535
    [hotwired#546]: hotwired#546
    [toggle]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLDetailsElement/toggle_event
    [turbo-events]: https://turbo.hotwired.dev/reference/events
    seanpdoyle committed Jul 28, 2022
    Copy the full SHA
    d33e66d View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    6cc689d View commit details
    Browse the repository at this point in the history