1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 9x 9x 9x 9x 9x 9x | const simulate = (event, elem, ...params) => { if (elem) { if (elem.trigger) { return elem.trigger(event, ...params) } if (elem[event]) { return elem[event](...params) } } } const click = simulate.bind(null, 'click') const submit = simulate.bind(null, 'submit') const focus = simulate.bind(null, 'focus') const blur = simulate.bind(null, 'blur') const touch = (elem) => { focus(elem) blur(elem) } export default { blur, click, focus, submit, touch } |