-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move admin pack from webpacker to vite
- Loading branch information
Showing
10 changed files
with
46 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
We want something like JQuery 'on', but without JQuery: | ||
https://api.jquery.com/on/ | ||
This is a bit tricky to get right. We cribbed this implementation from: | ||
https://stackoverflow.com/a/25248515/ | ||
If in JQuery you'd do: | ||
$(document).on("click", <selector>, handler) | ||
Now do something like: | ||
import delegateEvent from './lib/delegate_event.js'; | ||
delegateEvent(document, "click", <selector>, handler); | ||
ALL ARGS ARE REQUIRED for now. | ||
*/ | ||
|
||
export default function delegateEvent(container, event, selectorStr, handler) { | ||
container.addEventListener(event, function(e) { | ||
for (var target=e.target; target && target!=container; target=target.parentNode) { | ||
// loop parent nodes from the target to the delegation node | ||
if (target.matches(selectorStr)) { | ||
handler.call(target, e); | ||
break; | ||
} | ||
} | ||
}, false); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters