From 42dcfd3608e06c7b1333ca98e2ed419b412b4c08 Mon Sep 17 00:00:00 2001 From: Vikram Pasupathy Date: Mon, 24 Jun 2024 13:42:06 -0700 Subject: [PATCH] fix: Prevent shimming objects as a function even when objects start with on --- trace-anything.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trace-anything.js b/trace-anything.js index 70fa67b..6fa9bda 100644 --- a/trace-anything.js +++ b/trace-anything.js @@ -126,7 +126,8 @@ class TraceAnything { if (options.events) { // Shim any "on" event listener properties. - for (const k of allProperties.filter((k) => k.startsWith('on'))) { + for (const k of allProperties.filter( + (k) => (k.startsWith('on')) && object.hasOwnProperty(k))) { TraceAnything._shimEventListenerProperty( traced, object, k, className, options); }