File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 18
18
var target = e . target ,
19
19
value = target . value ,
20
20
inp = allInputs [ target . id ] ,
21
- parent = target ,
21
+ parent ,
22
22
input = { } ,
23
23
settings = { } ,
24
24
validation = false ,
25
+ currentMessage ,
25
26
message ,
26
- currentMessage = parent . querySelector ( '[role="alert"][for="' + target . id + '"]' ) ,
27
27
insertRef ;
28
28
29
- while ( parent . className . indexOf ( 'form--repeatable' ) === - 1 &&
30
- parent . className . indexOf ( 'form--field' ) === - 1 &&
31
- parent . className . indexOf ( 'form--fieldset' ) === - 1 ) {
32
- parent = parent . parentNode ;
33
- if ( parent === undefined ) {
34
- return ;
29
+ if ( typeof target . closest === 'function' ) {
30
+ parent = target . closest ( '.form--repeatable, .form--field, .form--fieldset' ) ;
31
+ }
32
+ else {
33
+ parent = target ;
34
+ while ( ! parent . classList . contains ( 'form--repeatable' ) &&
35
+ ! parent . classList . contains ( 'form--field' ) &&
36
+ ! parent . classList . contains ( 'form--fieldset' ) ) {
37
+ parent = parent . parentNode ;
38
+ if ( parent === undefined ) {
39
+ return ;
40
+ }
35
41
}
36
42
}
43
+ currentMessage = parent . querySelector ( '[role="alert"][for="' + target . id + '"]' ) ;
37
44
38
45
// Set up validation input
39
46
input . target = {
You can’t perform that action at this time.
0 commit comments