Skip to content

Commit 22dea31

Browse files
committed
Remove un-necessary comments
1 parent 58807a7 commit 22dea31

2 files changed

Lines changed: 0 additions & 15 deletions

File tree

src/events.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,8 @@ function onKeyup(e: KeyboardEvent) {
6464
}
6565
}
6666

67-
// The pointer events we intercept to make sure no external library ever hears
68-
// about a click before driver.js does. `click` carries the actual handler; the
69-
// rest are only suppressed.
7067
const DRIVER_CLICK_EVENTS = ["pointerdown", "mousedown", "pointerup", "mouseup", "click"] as const;
7168

72-
// Associates each driver element with the single document-level handler that
73-
// was registered on its behalf, so it can be removed when the element is torn
74-
// down. A WeakMap keyed by the element avoids leaking handlers onto `document`
75-
// (the popover is rebuilt every step) and needs no id bookkeeping on the DOM.
7669
const driverClickHandlers = new WeakMap<Element, (e: MouseEvent | PointerEvent) => void>();
7770

7871
/**
@@ -90,8 +83,6 @@ export function onDriverClick(
9083
listener: (pointer: MouseEvent | PointerEvent) => void,
9184
shouldPreventDefault?: (target: HTMLElement) => boolean
9285
) {
93-
// Defensive: if this element somehow already has a handler attached, remove
94-
// it first so we never register duplicates.
9586
destroyDriverClick(element);
9687

9788
const handler = (e: MouseEvent | PointerEvent) => {
@@ -106,8 +97,6 @@ export function onDriverClick(
10697
e.stopImmediatePropagation();
10798
}
10899

109-
// Only the actual click should invoke the user's listener; the other
110-
// events exist purely to suppress interaction beneath the overlay/popover.
111100
if (e.type === "click") {
112101
listener?.(e);
113102
}

tests/events.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ afterEach(() => {
77
vi.restoreAllMocks();
88
});
99

10-
// The document-level listeners driver.js attaches to intercept clicks.
1110
const DRIVER_EVENT_TYPES = ["click", "pointerdown", "mousedown", "pointerup", "mouseup"];
1211

1312
type ListenerRecord = {
@@ -24,9 +23,6 @@ function normalizeCapture(options?: boolean | AddEventListenerOptions | EventLis
2423
return !!options?.capture;
2524
}
2625

27-
// Wraps document.add/removeEventListener so we can assert that every driver
28-
// listener that gets attached is also detached, i.e. nothing leaks onto the
29-
// document across steps and teardown.
3026
function trackDocumentListeners() {
3127
const added: ListenerRecord[] = [];
3228
const removed: ListenerRecord[] = [];

0 commit comments

Comments
 (0)