diff --git a/src/lib/event-factory.js b/src/lib/event-factory.js index 0dff148..925cfb3 100644 --- a/src/lib/event-factory.js +++ b/src/lib/event-factory.js @@ -30,12 +30,13 @@ export function createEvent(overrides = {}) { } /** - * Deep-clone an event via structuredClone (available in modern browsers - * and Node 17+). Falls back to JSON round-trip for older environments. + * Deep-clone an event (or any plain-data object). + * + * Uses JSON round-trip rather than structuredClone because events may be + * wrapped in Vue reactive proxies, which structuredClone cannot handle. + * EventModel contains only plain data (strings, arrays, nested objects), + * so JSON cloning is safe and lossless here. */ export function cloneEvent(ev) { - if (typeof structuredClone === 'function') { - return structuredClone(ev) - } return JSON.parse(JSON.stringify(ev)) }