demo · v130
Replay harness
Draw a real pointer path across two boxes; the page captures the trusted event stream (with its coalesced sub-events), constructs synthetic equivalents using new PointerEvent() with coalescedEvents targeting box-A and box-B, dispatches them, and runs a 6-test contract suite verifying the Chrome 130 behaviour.
1. record (real pointer)
box A
box B
2. replay (synthetic, untrusted)
box A
box B
draw a path across both boxes
recorded sub-events
(nothing yet)
received synthetic sub-events
(nothing yet)
| contract | status |
|---|---|
| T1 · synthetic parent dispatches | — |
| T2 · coalescedEvents preserved as PointerEvents | — |
| T3 · sub-event 1 target stays on box A (not retargeted to pad) | — |
| T4 · sub-event 2 target stays on box B | — |
| T5 · offsetX/Y on sub-events match author-supplied values | — |
| T6 · sub-event isTrusted=false (still untrusted) | — |
the code
const subA = new PointerEvent("pointermove", {
clientX: 30, clientY: 30, pointerType: "mouse"
});
Object.defineProperty(subA, "target", { value: boxA });
const subB = new PointerEvent("pointermove", {
clientX: 200, clientY: 200, pointerType: "mouse"
});
Object.defineProperty(subB, "target", { value: boxB });
const parent = new PointerEvent("pointermove", {
clientX: 100, clientY: 100, coalescedEvents: [subA, subB]
});
pad.dispatchEvent(parent);
// Chrome 130+: parent.getCoalescedEvents()[0].target === boxA (preserved)
// Pre-Chrome 130: .target === pad (retargeted)