Process JS API requests ($.request(handler, options)) through the document object instead of a non-existent form element. The form element was originally added because the framework only supported requests made from within a form
```
[22:08:12] spunky: The $triggerEl was implemented because previously it was just $form
[22:08:24] spunky: For data-requests without a form, these events were being ignored
[22:08:31] spunky: So as a workaround I implemented $triggerEl
```
As this is no longer the case, any JS API requests will now be made through the document element instead to support listening to events (such as ajaxSetup) even when there is no real attached element to trigger them on.
- Used for handling flash messages via JS API
Request options are now passed to ajaxBeforeSend & ajaxPromise events
Improved framework extras
- Fixes data-request-flash when used within a plain form, this code would fail because $triggerEl is set to a plain form:
`<form><button data-request="..." data-request-flash>...</button></form>`
Adds support for passing objects to be used as the loading indicator. Note: Objects must support `.show()` and `.hide()` methods.
Example:
```js
$.request('onHandler', {
loading: $.oc.stripeLoadIndicator
});
```
This will request the Flash contents, if they are available. It also clears the flash bag contents, which is why this is an optional feature.
Introduced "ajaxValidation" event for capturing all invalid fields at once
This is a relic from when select2 v3 had no mobile support, we use select2 v4 now that has been tested with mobile/touch devices.
Refs #108
Clean up some white spaces
This is useful when an AJAX request link appears inside something like a dropdown. When the link is clicked, the dropdown should close like normal, however this is not the case since the value `false` is returned; so the expected behavior doesn't occur. As a solution, `false` is no longer returned, the default behavior on the event is prevented instead, allowing the propagation to proceed as normal.
I need this input type, and it would be handy if I could use it with data-track-input. I promise this will be the last time I ask you to touch your priceless faberge egg ;)
(Submitting an invalid form in the backend will result in a page refresh, flash messaegs are suppressed)
K.I.S.S > Performance + premature optimization is the root of all evil