File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,7 +112,17 @@ class FormCheck {
112112 }
113113}
114114
115- document . addEventListener ( 'DOMContentLoaded' , ( ) => {
115+ const initializeFormCheck = ( ) => {
116+ window . trickeries = window . trickeries || [ ] ;
116117 const forms = document . querySelectorAll ( '[wt-formcheck-element="form"]' ) ;
117- forms . forEach ( form => new FormCheck ( form ) ) ;
118- } ) ;
118+ forms . forEach ( form => {
119+ let instance = new FormCheck ( form ) ;
120+ window . trickeries . push ( { 'formCheck' : instance } ) ;
121+ } ) ;
122+ }
123+
124+ if ( / c o m p l e t e | i n t e r a c t i v e | l o a d e d / . test ( document . readyState ) ) {
125+ initializeFormCheck ( ) ;
126+ } else {
127+ window . addEventListener ( 'DOMContentLoaded' , initializeFormCheck )
128+ }
Original file line number Diff line number Diff line change @@ -68,4 +68,8 @@ const InitializeFormatNumbers = () => {
6868 }
6969}
7070
71- window . addEventListener ( 'DOMContentLoaded' , InitializeFormatNumbers ( ) ) ;
71+ if ( / c o m p l e t e | i n t e r a c t i v e | l o a d e d / . test ( document . readyState ) ) {
72+ InitializeFormatNumbers ( ) ;
73+ } else {
74+ window . addEventListener ( 'DOMContentLoaded' , InitializeFormatNumbers )
75+ }
Original file line number Diff line number Diff line change @@ -16,4 +16,8 @@ const LimitText = () => {
1616 }
1717}
1818
19- window . addEventListener ( 'DOMContentLoaded' , LimitText ( ) ) ;
19+ if ( / c o m p l e t e | i n t e r a c t i v e | l o a d e d / . test ( document . readyState ) ) {
20+ LimitText ( ) ;
21+ } else {
22+ window . addEventListener ( 'DOMContentLoaded' , LimitText )
23+ }
You can’t perform that action at this time.
0 commit comments