2018-10-09 11:43:25 +02:00
|
|
|
import { delegate } from '@utils';
|
2018-08-09 11:53:59 +02:00
|
|
|
|
2018-10-09 11:43:25 +02:00
|
|
|
delegate('blur keydown', 'input, textarea', ({ target }) => {
|
|
|
|
touch(target);
|
2017-07-26 12:41:23 +02:00
|
|
|
});
|
|
|
|
|
2018-10-09 11:43:25 +02:00
|
|
|
delegate(
|
|
|
|
'click',
|
|
|
|
'input[type="submit"]:not([formnovalidate])',
|
|
|
|
({ target }) => {
|
|
|
|
let form = target.closest('form');
|
|
|
|
let inputs = form ? form.querySelectorAll('input, textarea') : [];
|
|
|
|
[...inputs].forEach(touch);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
function touch({ classList }) {
|
|
|
|
classList.add('touched');
|
|
|
|
}
|