You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Introduce `FormLinkInterceptor`
In an effort to match the patterns established by `LinkInterceptor`
and `FormInterceptor`, this commit introduces a
`FormLinkInterceptor` and `FormLinkInterceptorDelegate`.
Behind the scenes, the `FormLinkInterceptor` relies on an instance of
the `LinkInterceptor` to intervene in `<a>` element clicks when
`[data-turbo-method]` or `[data-turbo-stream]` are present. When those
clicks are detected, it creates a `<form hidden>` element, attaches it
to the document, delegates to a `FormLinkInterceptorDelegate` to map
the `<a>` element's attributes to the `<form>` element, submits the form
through the polyfilled [HTMLFormElement.requestSubmit][] method, then
removes the `<form>` from the document.
The `Session` serves as a `FormLinkInterceptorDelegate`, making sure
to start and stop the observer _before_ its `LinkInterceptor`
instance, so that clicks that are intercepted by the
`FormLinkInterceptor` are not also intercepted by the
`LinkInterceptor`.
[HTMLFormElement.requestSubmit]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit
* Account for `[data-turbo="false"]` and `Turbo.session.drive = false`
Closes#500
<buttonid="submit-external">POST to https://httpbin.org/post</button>
301
301
</form>
302
+
<ahref="/__turbo/redirect?path=/src/tests/fixtures/frames/hello.html" data-turbo-method="post" data-turbo-frame="hello" id="turbo-method-post-to-targeted-frame">Turbo method post to targeted frame</a>
0 commit comments