mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
added the closest and trigger events out of the rules
This commit is contained in:
parent
ccd028c22d
commit
82e6588cd9
@ -207,8 +207,7 @@ class UserDefinedFormController extends PageController
|
||||
$rules .= $this->buildWatchJS($watch);
|
||||
}
|
||||
|
||||
// Only add customScript if $default or $rules is defined
|
||||
if ($rules) {
|
||||
// add the custom scripts thats used by the steps.
|
||||
Requirements::customScript(<<<JS
|
||||
function closest(el, sel) {
|
||||
while ((el = el.parentElement) && !((el.matches || el.matchesSelector).call(el,sel)));
|
||||
@ -223,6 +222,14 @@ class UserDefinedFormController extends PageController
|
||||
element.dispatchEvent(event);
|
||||
}
|
||||
window.triggerDispatchEvent = triggerDispatchEvent;
|
||||
JS
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Only add customScript if $default or $rules is defined
|
||||
if ($rules) {
|
||||
Requirements::customScript(<<<JS
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var form = document.querySelector('form.userform');
|
||||
if (form) {
|
||||
|
Loading…
Reference in New Issue
Block a user