Skip to content

Commit

Permalink
do not run if there is no root
Browse files Browse the repository at this point in the history
  • Loading branch information
janmarkuslanger committed Dec 1, 2024
1 parent b207850 commit 616b037
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/floating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const DEFAULTS = {
elements: [],
maxElements: 10,
interval: 2000,
root: document.body
root: document?.body
};


Expand Down Expand Up @@ -68,6 +68,11 @@ class Floating {
}

run() {
if (!this.settings.root) {
return;
}


const isMax = this.currentState.elements.length >= this.settings.maxElements;

if (isMax) {
Expand Down

0 comments on commit 616b037

Please sign in to comment.