diff --git a/src/filters.ts b/src/filters.ts
index 9544edc..6f816f1 100644
--- a/src/filters.ts
+++ b/src/filters.ts
@@ -1,5 +1,30 @@
// common filters for global events
-export function excludeElements() {
- // TODO: implement
+/**
+ * Creates a filter than can be passed to `` to exclude events from elements with the given tag names.
+ *
+ * @param tagNames - array of tag names to exclude
+ */
+export function excludeElements(tagNames: Array>) {
+ return (event: Event) => {
+ const target = event.target as HTMLElement
+ return !(tagNames as string[]).includes(target.tagName)
+ }
}
+
+/**
+ * Creates a filter than can be passed to `` to include events from elements with the given tag names.
+ *
+ * @see excludeElements
+ *
+ * @param tagNames - array of tag names to include
+ */
+export function includeElements(tagNames: Array>) {
+ return (event: Event) => {
+ const target = event.target as HTMLElement
+ return (tagNames as string[]).includes(target.tagName)
+ }
+}
+
+// @internal
+export type _HTMLElementNames = keyof HTMLElementTagNameMap