From a25b41ae44f41b99d125660e25e4a27e5ef4fc5c Mon Sep 17 00:00:00 2001 From: Walter Rafelsberger Date: Wed, 6 Jul 2022 18:45:28 +0200 Subject: [PATCH] Fix autoResize if passed in selector is already an element and not just a string. --- src/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 9117481..7c96961 100644 --- a/src/main.js +++ b/src/main.js @@ -144,7 +144,9 @@ export default function milestones(selector) { }; const resizeObserver = new ResizeObserver(resizeHandler); - resizeObserver.observe(document.querySelector(selector)); + resizeObserver.observe( + typeof selector === 'string' ? document.querySelector(selector) : selector + ); function setAutoResize(d) { autoResize.current = d;