From 0395baf207507d36d185224f1dd9280ee5b24df7 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Thu, 25 Jan 2024 19:46:56 +0330 Subject: [PATCH] Prevent `t.querySelectorAll is not a function` error (#13) --- CHANGELOG.md | 7 +++++-- index.js | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aebcb3..931cc7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Prevent `addedNode.querySelectorAll is not a function` error (#13) + ## [0.2.0] - 2024-01-04 ### Fixed -- Fixed left/right arrow key behavior in RTL content (#9) +- Fixed left/right arrow key behavior in RTL content (#9) ## [0.1.0] - 2023-08-26 ### Added -- Add style to fix bidi in the default theme (#4) +- Add style to fix bidi in the default theme (#4) ## [0.0.2] - 2023-08-25 diff --git a/index.js b/index.js index f71f8d0..5a123ad 100644 --- a/index.js +++ b/index.js @@ -275,6 +275,8 @@ const applyBidi = () => { if (mutation.type !== 'childList') return; mutation.addedNodes.forEach((addedNode) => { + if (addedNode.nodeType !== Node.ELEMENT_NODE) return; + if (addedNode.classList?.contains('ls-block')) setDirAuto(addedNode); const subLsBlocks = addedNode.querySelectorAll(cssSelector);