A DOM listener can begin with a perfectly valid owner and later resume with event.currentTarget === null. That is not a paradox and it is not evidence that the listener was registered incorrectly. It is a lifetime boundary: currentTarget identifies the target whose listener is being invoked during dispatch, while deferred work can outlive that invocation. The engineering question is therefore not “How do I keep the Event alive?” but “Which historical facts must this invocation carry across the dispatch boundary?”
This article treats that as an evidence problem. The fixture declares owner, origin, dispatch identity, gate identity, and expected completion order before any observation. Each listener invocation gets private local state. A controlled promise remains unresolved until the outer dispatchEvent() call has returned; only then does the controller mutate the fixture, release the gate, and collect the retained listener task. That timing is narrower and more testable than saying that every await in every event handler behaves identically.
The intended receipt is historical: “this invocation belonged to owner A when it began.” It is not authority to modify whichever interface exists later. The ten cases below distinguish an Event reference, target, a retained DOM node, a retained dataset, and copied primitive values. The proposed playbook is fully specified, but no qualifying real-browser execution was completed for this article. Every case therefore remains EXPECTED / NOT EXECUTED, and the overall provenance decision is HOLD_EVIDENCE until the fixture is run and reconciled in an owned browser environment.
Define the event provenance the worker must retain
The fixture starts from a finite provenance contract, not from whatever the late callback happens to observe. For each listener invocation, owner means the EventTarget whose listener is currently running; origin means the node onto which the event is dispatched; dispatch identity means the authored dispatch ordinal, which remains distinct even when one Event object is deliberately reused; and selected primitive fields are the small strings needed later, such as the owner element ID and data-record-id value captured during invocation.
The expected receipt is equally explicit. It must name the case, dispatch ordinal, Event-object identity, listener invocation ID, expected origin and owner, early copied primitives, gate identity, whether the outer dispatch had returned before release, relevant late values, task outcome, and receipt order. An independently authored manifest supplies the expected owner/origin pair. The worker under test is never allowed to define its own expectation from a late currentTarget, late target, or mutable dataset.
The ten-case inventory is fixed before execution. E01 establishes the synchronous checkpoint. E02 intentionally performs the failing deferred currentTarget read. E03 captures owner data early. E04 separates descendant origin from listener owner. E05 and E06 mutate a node and its dataset while work waits. E07 proves per-listener capture for two owners in one bubbling dispatch. E08 reverses completion. E09 detaches the owner. E10 sequentially reuses one Event object across two completed dispatches.
Historical provenance is deliberately weaker than future UI authority. A receipt can truthfully say “owner A handled dispatch 1” even when A has since been removed, renamed, superseded, or made irrelevant by later intent. No case publishes a command, starts a fetch, submits a form, schedules animation, or mutates application UI after resume.
Case | Dispatch ordinal | Expected origin | Expected registered owner | Gate identity | Expected completion order |
E01 | 1 | span-a | button-a | G01 | button-a |
E02 | 1 | span-a | button-a | G02 | button-a |
E03 | 1 | span-a | button-a | G03 | button-a |
E04 | 1 | span-a | button-a | G04 | button-a |
E05 | 1 | span-a | button-a | G05 | button-a |
E06 | 1 | span-a | button-a | G06 | button-a |
E07 | 1 | span-a | button-a, group-a | G07 | button-a, then group-a |
E08 | 1, 2 | span-a, span-b | button-a, button-b | G08-A, G08-B | button-b, then button-a |
E09 | 1 | span-a | button-a | G09 | button-a |
E10 | 1, 2 | span-a, span-b | button-a, button-b | G10-A, G10-B | button-a, then button-b |
Locate the lifetime boundary in native DOM dispatch
The contract comes from native dispatch, not from a timer heuristic. In the WHATWG DOM Living Standard dispatch and invocation algorithms consulted on 2026-12-01, invocation initializes event.currentTarget to the current path item's invocation target. Dispatch teardown then sets eventPhase to NONE, sets currentTarget to null, clears the event path, and unsets the dispatch flag. The consulted standard was dated November 25, 2026.
That sequence explains the central failure mode. Holding a JavaScript reference to the Event object does not preserve the dispatch-time value of currentTarget; the same Event object continues to exist while its dispatch-managed field changes during teardown. MDN's Event.currentTarget documentation, last modified December 19, 2024 and accessed 2026-12-01, states the same practical rule: the value is available in the handler and is null outside it, including when code retains the Event and later reads the property.
This page therefore asks a different question from Refonte's article on separating dispatch return from listener success. That article qualifies what the synchronous dispatchEvent() Boolean means. Here, invocation has already occurred; the issue is which owner data survives into work that resumes after dispatch teardown.
The fixture also avoids an overbroad slogan about await. MDN's await reference, accessed 2026-12-01, says await suspends the surrounding async function until the awaited value settles while the caller can resume. This laboratory supplies a deliberately unresolved native Promise and withholds its resolver until after the outer dispatch call returns. It does not claim that every already-settled await, native input event, or microtask checkpoint represents the same timing experiment.
Keep currentTarget separate from target
currentTarget names the listener attachment target being invoked. target names the object onto which the event was dispatched. MDN's Event.target documentation, accessed 2026-12-01, explicitly distinguishes those fields during bubbling or capturing.
For a bubbling event dispatched from span-a into a listener on button-a, the correct historical owner is the button and the origin is the span. Replacing a late-null currentTarget with target changes the question from “who owned this listener invocation?” to “where was this event dispatched?” E04 makes that substitution fail visibly. E10 adds a second warning: this fixture deliberately reuses one Event object sequentially, so a late read of that shared object's target can describe the second dispatch rather than the first invocation.
Build a browser fixture with explicit release gates
Use one owned page with native light-DOM elements. Do not substitute Node.js EventTarget, a DOM simulator, or a framework synthetic event. Save the following as provenance-fixture.html and open it in a real browser. The code resets the owned nodes between cases, creates unresolved native Promises, keeps resolvers private to the controller, assigns Event-object identities with a WeakMap, and records only authored strings, booleans, ordinals, and task outcomes in serialized receipts.
<!doctype html>
<meta charset="utf-8">
<title>DOM provenance fixture</title>
<main id="stage"></main>
<pre id="result"></pre>
<script>
(() => {
'use strict';
const TYPE = 'provenance-probe';
const HARNESS_VERSION = 'provenance-fixture/1.0.0';
const stage = document.querySelector('#stage');
const out = document.querySelector('#result');
const eventIds = new WeakMap();
let nextEvent = 0, nextInvocation = 0, nextReceipt = 0;
const allRows = [], pageErrors = [];
const manifest = Object.freeze([
{caseId:'E01', dispatchOrdinal:'1', origin:'span-a', owner:'button-a', gate:'G01', completion:'button-a'},
{caseId:'E02', dispatchOrdinal:'1', origin:'span-a', owner:'button-a', gate:'G02', completion:'button-a'},
{caseId:'E03', dispatchOrdinal:'1', origin:'span-a', owner:'button-a', gate:'G03', completion:'button-a'},
{caseId:'E04', dispatchOrdinal:'1', origin:'span-a', owner:'button-a', gate:'G04', completion:'button-a'},
{caseId:'E05', dispatchOrdinal:'1', origin:'span-a', owner:'button-a', gate:'G05', completion:'button-a'},
{caseId:'E06', dispatchOrdinal:'1', origin:'span-a', owner:'button-a', gate:'G06', completion:'button-a'},
{caseId:'E07', dispatchOrdinal:'1', origin:'span-a', owner:'button-a,group-a', gate:'G07', completion:'button-a,group-a'},
{caseId:'E08', dispatchOrdinal:'1,2', origin:'span-a,span-b', owner:'button-a,button-b', gate:'G08-A,G08-B', completion:'button-b,button-a'},
{caseId:'E09', dispatchOrdinal:'1', origin:'span-a', owner:'button-a', gate:'G09', completion:'button-a'},
{caseId:'E10', dispatchOrdinal:'1,2', origin:'span-a,span-b', owner:'button-a,button-b', gate:'G10-A,G10-B', completion:'button-a,button-b'}
]);
addEventListener('error', e => pageErrors.push({type:'error', message:e.message}));
addEventListener('unhandledrejection', e =>
pageErrors.push({type:'unhandledrejection', reason:String(e.reason)}));
function eventId(event) {
if (!eventIds.has(event)) eventIds.set(event, EV${++nextEvent});
return eventIds.get(event);
}
function gate(id) {
let resolve;
const promise = new Promise(r => { resolve = r; });
return {id, promise, release: resolve};
}
function fresh() {
stage.innerHTML =
<section id="fixture-root">
<div id="group-a" data-record-id="GROUP-A">
<button id="button-a" data-record-id="A" type="button">
<span id="span-a" data-origin-id="origin-A">A origin</span>
</button>
</div>
<div id="group-b" data-record-id="GROUP-B">
<button id="button-b" data-record-id="B" type="button">
<span id="span-b" data-origin-id="origin-B">B origin</span>
</button>
</div>
</section>;
const q = s => stage.querySelector(s);
return {root:q('#fixture-root'), groupA:q('#group-a'), groupB:q('#group-b'),
buttonA:q('#button-a'), buttonB:q('#button-b'), spanA:q('#span-a'), spanB:q('#span-b')};
}
function caseState(caseId) {
return {caseId, tasks:[], taskFailures:[], receipts:[], checkpoints:[],
dispatchReturned:new Map(), caseReceiptOrder:0};
}
function retainTask(state, promise, taskId) {
const tracked = promise.then(
value => ({taskId, outcome:'fulfilled', value}),
error => {
state.taskFailures.push({taskId, message:String(error)});
return {taskId, outcome:'rejected'};
});
state.tasks.push(tracked);
return tracked;
}
function startWorker(state, {event, gate, dispatchOrdinal, listenerLabel,
expectedNodeRef, sharedLatest}) {
const invocationId = I${++nextInvocation};
const savedOwnerNode = event.currentTarget;
const savedDataset = savedOwnerNode.dataset;
const early = {
ownerElementId: savedOwnerNode.id,
ownerRecordId: savedOwnerNode.dataset.recordId,
originElementId: event.target.id,
originRecordId: event.target.dataset.recordId || null,
originId: event.target.dataset.originId || null
};
const objectId = eventId(event);
state.checkpoints.push({phase:'inside', invocationId, dispatchOrdinal,
eventObjectId:objectId, currentTargetId:event.currentTarget.id,
targetId:event.target.id, early});
const work = (async () => {
await gate.promise;
const receipt = {
caseId: state.caseId, dispatchOrdinal, eventObjectId: objectId,
invocationId, listenerLabel, gateId: gate.id,
expectedOrigin: early.originElementId,
expectedOwner: early.ownerElementId,
earlyOwnerRecordId: early.ownerRecordId,
earlyOriginId: early.originId,
dispatchReturnedBeforeRelease: state.dispatchReturned.get(dispatchOrdinal) === true,
lateCurrentTargetIsNull: event.currentTarget === null,
lateTargetId: event.target && event.target.id,
lateTargetRecordId: event.target?.dataset?.recordId || null,
lateSavedNodeRecordId: savedOwnerNode.dataset.recordId,
lateSavedDatasetRecordId: savedDataset.recordId,
savedNodeIdentitySame: savedOwnerNode === expectedNodeRef,
savedNodeIsConnected: savedOwnerNode.isConnected,
sharedLatestOwnerAtResume: sharedLatest ? sharedLatest.value : null,
receiptOrder: ++nextReceipt,
caseReceiptOrder: ++state.caseReceiptOrder,
taskOutcome: 'fulfilled'
};
state.receipts.push(receipt);
return receipt;
})();
retainTask(state, work, ${state.caseId}:${invocationId});
}
function dispatch(state, target, event, ordinal) {
state.dispatchReturned.set(ordinal, false);
const value = target.dispatchEvent(event);
state.dispatchReturned.set(ordinal, true);
state.checkpoints.push({phase:'after-dispatch-return', dispatchOrdinal:ordinal,
eventObjectId:eventId(event), dispatchReturn:value,
currentTargetIsNull:event.currentTarget === null,
targetId:event.target && event.target.id});
}
const settle = state => Promise.all(state.tasks);
async function runCase(caseId) {
const d = fresh(), s = caseState(caseId);
if (caseId === 'E01' || caseId === 'E02' || caseId === 'E03' || caseId === 'E04') {
const g = gateG${caseId.slice(1)}), e = new Event(TYPE,{bubbles:true});
d.buttonA.addEventListener(TYPE, ev => startWorker(s,{event:ev,gate:g,
dispatchOrdinal:1,listenerLabel:'button-a',expectedNodeRef:d.buttonA}));
dispatch(s,d.spanA,e,1);
g.release();
await settle(s);
} else if (caseId === 'E05' || caseId === 'E06') {
const g = gateG${caseId.slice(1)}), e = new Event(TYPE,{bubbles:true});
d.buttonA.addEventListener(TYPE, ev => startWorker(s,{event:ev,gate:g,
dispatchOrdinal:1,listenerLabel:'button-a',expectedNodeRef:d.buttonA}));
dispatch(s,d.spanA,e,1);
d.buttonA.dataset.recordId='B';
g.release();
await settle(s);
} else if (caseId === 'E07') {
const g=gate('G07'), e=new Event(TYPE,{bubbles:true});
s.expectedListenerCount=2;
s.expectedOwners=['button-a','group-a'];
d.buttonA.addEventListener(TYPE, ev => startWorker(s,{event:ev,gate:g,
dispatchOrdinal:1,listenerLabel:'button-a',expectedNodeRef:d.buttonA}));
d.groupA.addEventListener(TYPE, ev => startWorker(s,{event:ev,gate:g,
dispatchOrdinal:1,listenerLabel:'group-a',expectedNodeRef:d.groupA}));
dispatch(s,d.spanA,e,1);
g.release();
await settle(s);
} else if (caseId === 'E08') {
const ga=gate('G08-A'), gb=gate('G08-B'), sharedLatest={value:null};
const ea=new Event(TYPE,{bubbles:true}), eb=new Event(TYPE,{bubbles:true});
d.buttonA.addEventListener(TYPE, ev => {
sharedLatest.value='A';
startWorker(s,{event:ev,gate:ga,dispatchOrdinal:1,
listenerLabel:'button-a',expectedNodeRef:d.buttonA,sharedLatest});
});
d.buttonB.addEventListener(TYPE, ev => {
sharedLatest.value='B';
startWorker(s,{event:ev,gate:gb,dispatchOrdinal:2,
listenerLabel:'button-b',expectedNodeRef:d.buttonB,sharedLatest});
});
dispatch(s,d.spanA,ea,1);
dispatch(s,d.spanB,eb,2);
gb.release();
await Promise.resolve();
ga.release();
await settle(s);
} else if (caseId === 'E09') {
const g=gate('G09'), e=new Event(TYPE,{bubbles:true});
d.buttonA.addEventListener(TYPE, ev => startWorker(s,{event:ev,gate:g,
dispatchOrdinal:1,listenerLabel:'button-a',expectedNodeRef:d.buttonA}));
dispatch(s,d.spanA,e,1);
d.buttonA.remove();
g.release();
await settle(s);
} else if (caseId === 'E10') {
const ga=gate('G10-A'), gb=gate('G10-B'), e=new Event(TYPE,{bubbles:true});
d.buttonA.addEventListener(TYPE, ev => startWorker(s,{event:ev,gate:ga,
dispatchOrdinal:1,listenerLabel:'button-a',expectedNodeRef:d.buttonA}));
d.buttonB.addEventListener(TYPE, ev => startWorker(s,{event:ev,gate:gb,
dispatchOrdinal:2,listenerLabel:'button-b',expectedNodeRef:d.buttonB}));
dispatch(s,d.spanA,e,1);
dispatch(s,d.spanB,e,2);
ga.release();
gb.release();
await settle(s);
}
allRows.push(s);
return s;
}
async function runAll() {
const startedUtc = new Date().toISOString();
for (const id of ['E01','E02','E03','E04','E05','E06','E07','E08','E09','E10'])
await runCase(id);
out.textContent = JSON.stringify({
harnessVersion:HARNESS_VERSION,
startedUtc,
finishedUtc:new Date().toISOString(),
userAgent:navigator.userAgent,
manifest,
pageErrors,
cases:allRows
}, null, 2);
}
runAll().catch(error => {
out.textContent = JSON.stringify({fatal:String(error),pageErrors},null,2);
});
})();
</script>Run it as an ordinary local file or from an owned static server, then preserve the rendered JSON exactly as evidence. A simple static-server launch is sufficient; the important requirement is that the page execute in a real browser rather than in Node.js or a DOM simulation.
python3 -m http.server 8000Open the local fixture page in the browser under test.
For a controlled run, use this procedure in order. Start from a new page load and confirm that no earlier fixture nodes or ledgers survive. Record the exact browser executable/build from the runtime you actually launch, not from documentation. Start the harness and preserve its declared provenance-fixture/1.0.0 identity. For every case, verify that the gate is unresolved while dispatchEvent() is on the stack; verify the after-dispatch-return checkpoint; apply only the case's prescribed mutation; release only the named gate or gates; await the retained tasks; and copy the final JSON as one artifact. Finally, reconcile that artifact against the manifest that was declared independently before dispatch.
If automation is used, add an external bounded deadline that marks the experiment incomplete; a timeout must never be converted into “no receipt, therefore success.” Preserve UTC start/finish time, the full result, task failures, and unexpected page errors. The userAgent field can aid identification, but it should not be promoted into a substitute for the actual executable/build record. This article does not supply runtime values because no qualifying run completed. That status is intentional: a proposed fixture is evidence design, not an observed compatibility claim.
Retain the listener tasks yourself
dispatchEvent() returns a Boolean; it does not collect promises returned by async listener work. The thin listener wrapper must therefore start the worker synchronously, retain its promise in an owned tasks collection, and attach fulfillment/rejection handling immediately. The case is complete only after its prescribed gates have been released and all retained tasks have settled.
That distinction also makes missing work observable. If E07 expects two invocations, the harness first declares expectedListenerCount = 2 and the expected owner list, then compares both receipts after settlement. If E08 or E10 leaves a promise orphaned, the external deadline should classify the experiment incomplete rather than letting a missing receipt disappear from the report. A fulfilled task is necessary but not sufficient: duplicate, missing, or misattributed receipts are still provenance failures.
Reproduce the late currentTarget read
E01 and E02 establish the failure without relying on arbitrary delays. Each case starts from fresh A/B nodes and empty ledgers. The listener is attached to button-a; the event is a new Event('provenance-probe', {bubbles:true}); dispatch begins at span-a. Inside the listener, the expected synchronous checkpoint is currentTarget.id === 'button-a', target.id === 'span-a', owner record A, and origin marker origin-A. The wrapper starts one worker and retains one task.
E01: synchronous baseline. The controller calls span-a.dispatchEvent(event) and does not release G01 until that outer call has returned. Immediately after return, before gate release, the expected checkpoint is event.currentTarget === null; the target remains span-a in this light-DOM case. The worker's later receipt is useful only as a ledger-completion convenience; E01's actual purpose is to prove the two checkpoints. Expected task outcome: fulfilled. Expected receipt order inside the case: one receipt from button-a. Decision if all checks match: ACCEPT_CAPTURE for the baseline checkpoint, while still recognizing that the deferred owner must come from captured data.
E02: failing deferred read. Reset the fixture, register the same listener, dispatch from span-a, return from dispatchEvent(), then release G02. The worker intentionally asks only whether event.currentTarget can provide the owner after resume. Expected late value: null; expected classification: missing-owner; expected task outcome: fulfilled, not rejected. The negative result must be serialized instead of throwing an uncontrolled exception that could hide E03–E10. Expected receipt order: one button-a receipt. Provenance decision: REPAIR_DEFERRED_READ because the invocation occurred but the worker postponed the owner read past its lifetime.
These expectations follow the DOM teardown rule and MDN's explicit currentTarget lifetime description. A fixed setTimeout() would not improve this evidence: the required boundary is the controller's recorded return from the exact outer dispatch call, followed by the case's controlled mutation and gate release.
Capture the owner and the required primitive values
E03 is the repair case. Reset the fixture. Inside the listener, before any await, copy the smallest values the deferred worker actually needs: ownerElementId, ownerRecordId, originElementId, and, when relevant, a dedicated origin marker. Keep a node reference only if the integration separately needs object identity or later DOM inspection. The historical record should not depend on that live reference for values that must describe event time.
A compact application-facing capture can look like this:
function captureProvenance(event, dispatchOrdinal, invocationId) {
const owner = event.currentTarget;
const origin = event.target;
return Object.freeze({
dispatchOrdinal,
invocationId,
ownerElementId: owner.id,
ownerRecordId: owner.dataset.recordId,
originElementId: origin.id,
originMarker: origin.dataset.originId || null
});
}The freeze in this example protects the small JavaScript record from accidental reassignment; it does not freeze the DOM, the application record named by ownerRecordId, or any future authorization decision.
E03: early capture. With a new A fixture, capture button-a, A, span-a, and origin-A before awaiting G03. Let dispatch return, make no mutation, then release. Expected late event.currentTarget: null. Expected copied owner record: still A. Expected saved node identity: the same button-a object. Expected live node record: also A only because this case deliberately makes no mutation. Expected task outcome: fulfilled; expected receipt order: one. Decision: ACCEPT_CAPTURE if the early fields match the independent manifest and the gate was not released early.
The important evidence is not that every field happens to agree in E03. It is that the receipt keeps distinct columns for early scalar values, late Event state, and late live-object state. E05 and E06 will make those columns diverge on purpose.
A node reference is not a value snapshot
const savedOwner = event.currentTarget preserves a binding to one object. It does not make that DOM object's attributes immutable. If another step changes savedOwner.dataset.recordId, a later read through the saved node sees the changed value. That is why savedOwner === originalButton and savedOwner.dataset.recordId === 'A' answer different questions.
Use identity when identity is the fact under test. Use a copied primitive when a historical label is the fact under test. Mixing them is a common source of apparently “stale” or “wrong” data: the reference is doing exactly what references do, while the application expected snapshot semantics it never created.
Compare a descendant origin with its listener owner
E04 rejects the convenient but incorrect repair “use event.target when currentTarget is null.” Reset the fixture so button-a has data-record-id="A" and its child span-a has a distinct data-origin-id="origin-A" but no owner record key. Register the listener only on button-a, then dispatch a bubbling provenance-probe from span-a.
Inside the listener, expected values are unambiguous: owner element button-a, owner record A, origin element span-a, origin marker origin-A. Return from dispatch before releasing G04. At resume, event.currentTarget is expected to be null, while event.target is expected to identify span-a. Therefore event.target.dataset.recordId is null in this fixture and cannot satisfy the declared owner contract. Early owner capture still yields A.
Expected task outcome is fulfilled. Expected receipt order is one. The provenance decision is ACCEPT_CAPTURE for the early owner fields and REPAIR_DEFERRED_READ for any implementation that substitutes target for owner. The control matters because target and currentTarget are intentionally different properties with different meanings, not interchangeable spellings.
This is also separate from validating listener binding after cloning. No clone exists here, and registration is already correct. The test begins only after the intended listener has demonstrably been entered.
Change dataset while deferred work is waiting
E05 and E06 introduce a mutation strictly between dispatch return and gate release. That order is the control. The event enters the correctly registered listener while the button's record key is A; the worker suspends; the outer dispatchEvent() returns; the controller changes button-a.dataset.recordId to B; only then does it release the promise.
E05: live-node control. Reset, register on button-a, dispatch from span-a, and capture both savedOwnerNode and the early scalar ownerRecordId. Expected early values: owner element button-a, owner record A, origin span-a. After return, set the same button's record key to B, then release G05. Expected late currentTarget: null. Expected node identity comparison: savedOwnerNode === originalButton is true. Expected connection state: true, because the button remains in the document. Expected savedOwnerNode.dataset.recordId: B. Expected copied primitive: A. Task fulfills with one receipt. Decision: ACCEPT_CAPTURE for the scalar historical owner; a design that reads the saved node's record key late is REPAIR_DEFERRED_READ.
E06: live-map control. Reset again. During invocation save const savedDataset = event.currentTarget.dataset and separately copy const ownerRecordId = event.currentTarget.dataset.recordId. Return from dispatch, change the button's data-record-id from A to B, then release G06. Expected savedDataset.recordId: B; expected copied scalar: A; expected late currentTarget: null; node identity stays true and connected. The task fulfills with one receipt. Decision: ACCEPT_CAPTURE only for the copied field. Treating the retained DOMStringMap as a historical snapshot requires REPAIR_DEFERRED_READ.
MDN's HTMLElement.dataset documentation, accessed 2026-12-01, describes dataset as a DOMStringMap that provides read/write access to the element's data-* attributes. Saving that map is therefore categorically different from copying one string from it.
Copy fields, not the DOMStringMap reference
The recommended boundary is selective. Copy recordId if the later worker needs the event-time record label. Do not turn every attribute into a giant “snapshot” by default, and do not mistake the copied label for a frozen business object. A string A can remain historically accurate even if the application record named A is later edited, deleted, superseded, or no longer authorized for a UI action.
That distinction keeps the interface testable. The receipt can prove what string the listener observed during invocation. It cannot prove the continued existence or validity of the external entity that string names.
Capture each listener invocation independently
E07 tests per-invocation ownership with one bubbling event and two registered owners. Reset the fixture. Before dispatch, declare expectedListenerCount = 2 and the independent owner list ['button-a', 'group-a']. Register one listener on button-a and one on its ancestor group-a; both wrappers create their own invocation ID, private captures, task, and receipt. Dispatch one event from span-a and keep G07 unresolved until the outer call returns.
The expected synchronous sequence is button listener first, then ancestor listener as the event bubbles. The first invocation captures owner element button-a and owner record A. The second captures owner element group-a and owner record GROUP-A. Both capture the same origin element span-a and the same Event-object identity, but they must not share an invocation ID or overwrite one shared owner slot.
After return, release G07. Both late currentTarget reads are expected to be null; each local early record remains distinct. Expected task outcomes: two fulfilled tasks. Expected case receipt order after one gate release follows the workers' registration/invocation order in this controlled fixture: button-a, then group-a. The harness must reject one missing receipt, one duplicate owner, or two receipts containing the same last-seen owner. Provenance decision: ACCEPT_CAPTURE only when the count is exactly two and the owner multiset matches the manifest.
This light-DOM test does not reproduce Shadow DOM retargeting or composed-path questions. Refonte's separate article on proving event delivery across a shadow boundary owns that routing problem. Here, the route is intentionally simple so the test isolates deferred owner capture.
Reverse completion order without losing provenance
E08 shows why asynchronous completion order cannot stand in for dispatch order. Reset the fixture. Create separate Event objects and separate gates for A and B. Register one listener on button-a and one on button-b. Dispatch event A from span-a first, wait for that outer dispatch to return, then dispatch event B from span-b and wait for its return. Each invocation captures its own dispatch ordinal, owner string, origin string, Event-object identity, and invocation ID.
Now release G08-B before G08-A. The expected dispatch order is A then B. The expected completion order is B then A. B's receipt should say dispatch 2, owner button-b, record B, origin span-b; A's later receipt should still say dispatch 1, owner button-a, record A, origin span-a. Both late currentTarget values are expected null. Both tasks should fulfill, and the case receipt-order field should be 1 for B and 2 for A.
The negative comparison deliberately maintains one shared latestOwner. A's listener writes A; B's later listener overwrites it with B. Because B is dispatched before either gate is released, both workers can see B when they eventually resume. That shared variable therefore mislabels the older A invocation even though every promise fulfills normally.
Expected decision: ACCEPT_CAPTURE when per-invocation locals preserve A/B by dispatch order and B/A by completion order. Any implementation that reconstructs ownership from the shared latest variable is REPAIR_DEFERRED_READ. If task settlement or receipt counts are incomplete, use RERUN_HARNESS rather than interpreting partial order.
Reject a shared last-event variable
A “latest event” or “latest owner” slot is mutable shared state, not provenance. It is appropriate only when the contract actually asks for the current latest value. It is the wrong storage model for evidence attached to multiple in-flight invocations.
The repair is ordinary lexical scope: copy required fields into locals for that invocation, pass the resulting record into the async worker, and keep the worker's promise in the owning task collection. This solves association. It does not solve a different integration question such as whether dispatch 1 is still allowed to change a UI after dispatch 2 has occurred.
Handle detached nodes and deliberate event reuse
E09 and E10 are separate controls because node lifetime and Event-object reuse stress different assumptions.
E09: detached owner. Reset the fixture, dispatch from span-a to the listener on button-a, and capture the node plus primitive owner fields. After the outer dispatch returns, call button-a.remove() before releasing G09. Expected early owner record: A. Expected late currentTarget: null. Expected node identity: still the same saved object. Expected savedOwnerNode.isConnected: false. Expected copied owner string: A. Task outcome: fulfilled; receipt order: one. MDN's Node.isConnected documentation, last modified June 15, 2026 and accessed 2026-12-01, defines the property as whether the node is connected directly or indirectly to a Document. It does not certify authorization, freshness, or historical correctness. Decision: ACCEPT_CAPTURE for the historical primitive fields; the detached live node is evidence of identity and connection state only.
Detachment is not listener cleanup and does not cancel already-started work. Those responsibilities belong to a different lifecycle boundary, covered by Refonte's article on listener identity and disposal.
E10: sequential Event reuse. Reset. Create one Event object. Register a listener on A and a listener on B, with separate gates. Dispatch that same object from span-a; let the first outer call finish while A's worker remains gated. Then, and only then, dispatch the same Event object from span-b; let the second outer call finish. This is deliberate sequential reuse, not recursion or simultaneous dispatch. The DOM teardown unsets the dispatch flag before the second call begins.
Expected early capture for invocation 1: owner A, origin span-a. Expected early capture for invocation 2: owner B, origin span-b. Both receipts carry the same WeakMap Event-object identity but different dispatch ordinals and invocation IDs. After the second dispatch, a late read of the shared event.target can identify span-b even for A's older worker, while late currentTarget is null. Release G10-A then G10-B; expect two fulfilled receipts in A/B completion order. Decision: ACCEPT_CAPTURE only for the per-invocation primitives and authored dispatch identities. Using Event-object identity as dispatch identity requires REPAIR_DEFERRED_READ.
Reconcile the ten cases and their receipts
The harness should reconcile authored expectations against serialized observations, not against console impressions. The schema below intentionally stores scalar labels and identity booleans rather than trying to serialize DOM nodes. It also keeps Event-object identity separate from dispatch ordinal so E10 can represent two dispatches of one object.
{
"caseId": "E05",
"dispatchOrdinal": 1,
"eventObjectId": "EV5",
"invocationId": "I5",
"expectedOrigin": "span-a",
"expectedOwner": "button-a",
"gateId": "G05",
"earlyOwnerRecordId": "A",
"earlyOriginId": "origin-A",
"dispatchReturnedBeforeRelease": true,
"lateCurrentTargetIsNull": true,
"lateTargetId": "span-a",
"lateTargetRecordId": null,
"lateSavedNodeRecordId": "B",
"lateSavedDatasetRecordId": "B",
"savedNodeIdentitySame": true,
"savedNodeIsConnected": true,
"taskOutcome": "fulfilled",
"receiptOrder": 5
}Because no qualifying browser run completed, the observed columns remain blank. They must be populated only from the actual retained result of the real-browser page.
Case | Expected decisive result | Expected decision | Observed runtime | Observed result |
E01 | Inside owner A; after dispatch currentTarget null | ACCEPT_CAPTURE | ||
E02 | Deferred currentTarget null; missing-owner classified | REPAIR_DEFERRED_READ | ||
E03 | Early A preserved; late currentTarget null | ACCEPT_CAPTURE | ||
E04 | target is span, not owner; early owner A passes | ACCEPT_CAPTURE | ||
E05 | Saved node reads B; copied scalar remains A | ACCEPT_CAPTURE | ||
E06 | Saved dataset reads B; copied scalar remains A | ACCEPT_CAPTURE | ||
E07 | Exactly two owner receipts: button A and group A | ACCEPT_CAPTURE | ||
E08 | Completion B/A, dispatch A/B; locals remain correct | ACCEPT_CAPTURE | ||
E09 | Same node identity, disconnected; copied A preserved | ACCEPT_CAPTURE | ||
E10 | Same Event ID, two dispatch IDs; early A/B preserved | ACCEPT_CAPTURE |
A rejected task is a failure even when other receipts look correct. So is an unexpected page error, an early gate release, a duplicate receipt, a missing receipt, a wrong owner, or an owner inferred from the callback under test rather than the manifest. A deadline expiration means the experiment is incomplete; it cannot be converted into an assertion that “nothing happened.”
The reconciliation should also preserve both order axes instead of sorting them away. Dispatch ordinal is authored before execution; receipt order is observed after gates release. In E08 those sequences are intentionally different, and collapsing them into one timestamp-like field would erase the evidence the case was designed to produce. E10 makes a parallel point about identity: one Event-object ID is expected to appear beside two dispatch ordinals. A validator that requires a one-to-one Event/dispatch mapping would reject a legal sequential-reuse control for the wrong reason. The acceptance logic must therefore compare each field against the contract that gave that field meaning, rather than applying one generic uniqueness rule to the entire record.
Repair capture boundaries without inventing lost data
The repair is to move required historical reads to the dispatch-time boundary. Capture event.currentTarget while the listener is being invoked, copy the specific primitive values the later worker needs, and place those values in per-invocation locals. Start the async worker from a thin synchronous wrapper and retain its task immediately. Preserve the old failing E02 evidence so the change is attributable to the capture boundary rather than to a silent test rewrite.
Do not repair missing provenance by guessing later. If a past worker resumes without a trusted owner record, classify the provenance as UNKNOWN_PROVENANCE. Reading whatever element currently occupies a selector, using the latest global owner, or substituting event.target can produce a plausible value that was never actually observed for that invocation. That is worse than an explicit unknown because it turns missing evidence into fabricated certainty.
The recommended repair sequence is: rebuild the owned fixture from clean nodes; declare the manifest; register the intended listeners; capture owner/origin primitives inside each invocation; dispatch; record the exact return boundary; perform the prescribed mutation; release the correct gate; await every retained task; then reconcile receipt multiplicity, identity, order, and values. Re-running the same ten cases matters because a local fix for E02 can still fail E05, E07, E08, or E10.
Retaining a node remains legitimate when the integration genuinely needs the node object later. The important discipline is to name that fact separately from historical values. savedOwnerNode === buttonA proves object identity; savedOwnerNode.isConnected proves connection state at the later checkpoint; savedOwnerNode.dataset.recordId reads a later mutable attribute; earlyOwnerRecordId reports the event-time string. One field should not impersonate another.
The same boundary applies to dataset: copy the selected string, not the DOMStringMap, when history is the requirement. MDN documents dataset as live access to custom attributes, while the DOM standard documents the currentTarget teardown that forces the owner capture to happen during invocation.
Historical evidence does not authorize a future UI write
A historically correct A receipt can coexist with a later interface in which B is current, A is detached, or a newer operation owns the presentation. Provenance answers “which invocation was this?” It does not answer “may this result now mutate the UI?”
That second question needs its own integration policy, such as generation or ownership checks. Refonte's separate playbook on checking which asynchronous result owns the UI addresses that class of stale-completion problem. This article does not reproduce its network or UI-commit laboratory.
Define the release decision and integration boundaries
Acceptance is bounded to the declared evidence. An ACCEPT_CAPTURE result means the fixture demonstrated that early per-invocation primitive capture preserved the declared owner/origin facts across the explicit dispatch-return boundary and controlled mutations. It does not imply cross-browser compatibility beyond the runtimes actually executed, nor does it establish the timing of every trusted native event or every possible await.
Decision | Use when | Required action |
ACCEPT_CAPTURE | All expected receipts exist once, gates released after dispatch return, primitive provenance matches manifest, and no unexpected task/page failure occurred | Accept only the bounded historical-capture contract |
REPAIR_DEFERRED_READ | Late currentTarget, target substitution, live node/dataset read, shared latest variable, or Event-object identity is being used as historical owner evidence | Move required reads into per-invocation dispatch-time capture and rerun |
HOLD_EVIDENCE | Fixture is specified but no qualifying run exists, or required environment/result artifacts were not retained | Do not publish an observed-browser claim; execute and preserve evidence |
UNKNOWN_PROVENANCE | A past invocation lacks trustworthy owner/origin capture and cannot be reconstructed from independent evidence | Preserve unknown; do not infer from current DOM state |
RERUN_HARNESS | Timeout, missing/duplicate receipt, rejected task, early gate release, unexpected page error, or harness inconsistency makes the run incomplete | Recreate clean fixture and rerun before interpreting behavior |
Responsibility should be explicit. Frontend maintainers own the event schema, listener placement, and capture boundary. QA owns the independent expected manifest, gate sequencing, complete task reconciliation, and preservation of the result artifact. The integration owner separately decides whether any later operation is authorized to change current UI state. Those roles can be held by the same person, but the evidence channels should remain distinct.
Revalidation is warranted when listener placement changes, the set of captured fields changes, Event reuse is introduced or removed, a framework adapter begins wrapping native events, or the fixture's completion controls change. The rerun should use fresh owned nodes and listeners for each case. Do not carry a mutated A button or a prior task ledger into the next case.
Operational acceptance remains HOLD_EVIDENCE. The fixture and expected manifest are complete, but no qualifying real-browser observation is asserted. No browser version, log, timing measurement, fingerprint, or successful assertion is reported.
Build stronger JavaScript practice with Refonte Learning
This experiment is specialist browser work, but the underlying habits are ordinary frontend engineering: define data ownership, understand JavaScript references, distinguish synchronous callback state from deferred work, keep asynchronous tasks observable, and write tests whose expected values do not come from the code under test.
Refonte Learning's Frontend Development program lists HTML/CSS, JavaScript ES6+, React, Redux, APIs/AJAX, Git, accessibility/performance, and a capstone among its curriculum areas. The main program block lists four months at 10–12 hours per week and describes practical projects, guidance, a potential internship, and certificates on successful completion. Confirm the current program duration before enrolling.
Those foundations are relevant to the discipline used here without implying that this exact currentTarget/await laboratory is part of the curriculum. For maintainers who want more structured practice around JavaScript and project work, the program can provide a broader setting in which precise event ownership and test boundaries become normal engineering habits rather than one-off debugging tricks.
