File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,18 @@ function setLoadingState(event: Event) {
99
99
const input = event . currentTarget
100
100
if ( ! ( input instanceof HTMLInputElement ) ) return
101
101
102
+ const autoCheckElement = input . closest ( 'auto-check' )
103
+ if ( ! ( autoCheckElement instanceof AutoCheckElement ) ) return
104
+
105
+ const src = autoCheckElement . src
106
+ const csrf = autoCheckElement . csrf
107
+ const state = states . get ( autoCheckElement )
108
+
109
+ // If some attributes are missing we want to exit early and make sure that the element is valid.
110
+ if ( ! src || ! csrf || ! state ) {
111
+ return
112
+ }
113
+
102
114
let message = 'Verifying…'
103
115
const setValidity = text => ( message = text )
104
116
input . dispatchEvent (
@@ -108,8 +120,7 @@ function setLoadingState(event: Event) {
108
120
} )
109
121
)
110
122
111
- const autoCheckElement = input . closest ( 'auto-check' )
112
- if ( autoCheckElement instanceof AutoCheckElement && autoCheckElement . required ) {
123
+ if ( autoCheckElement . required ) {
113
124
input . setCustomValidity ( message )
114
125
}
115
126
}
You can’t perform that action at this time.
0 commit comments