1
0
Mirror von https://github.com/coolaj86/ajquery.js.git synchronisiert 2024-11-16 17:29:02 +00:00

feature: $.on(sel, ev, fn) for persistent events

Dieser Commit ist enthalten in:
AJ ONeal 2021-07-27 17:08:55 -06:00
Ursprung 6e6341d9ad
Commit a64fd3f93c

Datei anzeigen

@ -5,3 +5,12 @@ function $(sel, el) {
function $$(sel, el) {
return (el || document).querySelectorAll(sel);
}
$.on = function (sel, event, fn) {
document.body.addEventListener(function (ev) {
if (!ev.target.matchSelector(sel)) {
return true;
}
fn.call(ev.target, ev);
});
};