From 5957a395da925f20edd4a930dd051430473b6711 Mon Sep 17 00:00:00 2001 From: "paseo-bot[bot]" <266920839+paseo-bot[bot]@users.noreply.github.com> Date: Sat, 7 Nov 2026 15:55:12 +0000 Subject: [PATCH] refactor(desktop): select native field setters with explicit branches --- .../src/features/browser-automation/snapshot-engine.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/desktop/src/features/browser-automation/snapshot-engine.ts b/packages/desktop/src/features/browser-automation/snapshot-engine.ts index 71a688c7b2..e6fc74a3c9 100644 --- a/packages/desktop/src/features/browser-automation/snapshot-engine.ts +++ b/packages/desktop/src/features/browser-automation/snapshot-engine.ts @@ -317,8 +317,12 @@ function buildFillScript(metadata: BrowserRefMetadata, value: string): string { const nextValue = ${JSON.stringify(value)}; if ('value' in element) { const view = element.ownerDocument.defaultView; - const prototype = element.tagName === 'INPUT' ? view.HTMLInputElement.prototype - : element.tagName === 'TEXTAREA' ? view.HTMLTextAreaElement.prototype : null; + let prototype = null; + if (element.tagName === 'INPUT') { + prototype = view.HTMLInputElement.prototype; + } else if (element.tagName === 'TEXTAREA') { + prototype = view.HTMLTextAreaElement.prototype; + } // Bypass instance setters so framework value trackers observe the input event as a change. if (prototype) Object.getOwnPropertyDescriptor(prototype, 'value').set.call(element, nextValue); else element.value = nextValue;