Skip to content

Commit 56b73e2

Browse files
committed
Run init in DOMContentLoaded
1 parent 7fc70cb commit 56b73e2

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

assets/scripts/wplf-form.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ window.wplf = {
9595
};
9696

9797
var main = function () {
98-
document.addEventListener("DOMContentLoaded", function() {
99-
[].forEach.call(document.querySelectorAll(".libre-form"), window.wplf.attach);
100-
});
98+
[].forEach.call(document.querySelectorAll(".libre-form"), window.wplf.attach);
10199
};
102100

103101
var dependencies = [];
@@ -110,7 +108,6 @@ if (!window.Promise) {
110108
dependencies.push('Promise');
111109
}
112110

113-
initialize(dependencies, main);
114111

115112
function initialize(dependencies, app) {
116113
var dependency_count = dependencies.length;
@@ -145,3 +142,7 @@ function initialize(dependencies, app) {
145142

146143
run_when_ready();
147144
}
145+
146+
document.addEventListener('DOMContentLoaded', function() {
147+
initialize(dependencies, main);
148+
});

0 commit comments

Comments
 (0)