Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
6
test/on/on.js
Normal file
6
test/on/on.js
Normal file
@ -0,0 +1,6 @@
|
||||
const on = (el, evt, fn, opts = {}) => {
|
||||
const delegatorFn = e => e.target.matches(opts.target) && fn.call(e.target, e);
|
||||
el.addEventListener(evt, opts.target ? delegatorFn : fn, opts.options || false);
|
||||
if (opts.target) return delegatorFn;
|
||||
};
|
||||
module.exports = on;
|
||||
Reference in New Issue
Block a user