Skip to content

Commit 6a6fd34

Browse files
committed
Fix a bug that treated an empty node list as a node
1 parent 9f52cb1 commit 6a6fd34

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/josh.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Josh {
6262
}
6363
//Adding css to DOM
6464
addCss(targetElm) {
65-
if (targetElm.length > 0) {
65+
if (targetElm instanceof NodeList) {
6666
targetElm.forEach((elm) => {
6767
this.cssUtil(elm);
6868
});
@@ -91,7 +91,7 @@ class Josh {
9191
threshold: this.offset,
9292
}
9393
);
94-
if (domElement.length > 0) {
94+
if (domElement instanceof NodeList) {
9595
//Observing every element
9696
domElement.forEach((animItem) => {
9797
intetsectObserver.observe(animItem);

0 commit comments

Comments
 (0)