Skip to content

Commit

Permalink
Fix autoResize if passed in selector is already an element and not ju…
Browse files Browse the repository at this point in the history
…st a string.
  • Loading branch information
walterra committed Jul 6, 2022
1 parent d056687 commit a25b41a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a25b41a

Please sign in to comment.