From 29c3cd6cfbff7c588f301c3d231fb3eb57bc7075 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Thu, 25 Jan 2024 19:32:11 +0330 Subject: [PATCH 1/3] Fix the bug --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index f71f8d0..13ca93c 100644 --- a/index.js +++ b/index.js @@ -275,6 +275,7 @@ const applyBidi = () => { if (mutation.type !== 'childList') return; mutation.addedNodes.forEach((addedNode) => { + if (addedNode.nodeType === 3) return; if (addedNode.classList?.contains('ls-block')) setDirAuto(addedNode); const subLsBlocks = addedNode.querySelectorAll(cssSelector); From 32502a3e74018bce2f0c8b88312accee9164acc8 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Thu, 25 Jan 2024 19:34:06 +0330 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 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 From 457f27e495888435a78db348456a9d87216760c2 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Thu, 25 Jan 2024 19:44:34 +0330 Subject: [PATCH 3/3] Use enum for better readability --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 13ca93c..5a123ad 100644 --- a/index.js +++ b/index.js @@ -275,7 +275,8 @@ const applyBidi = () => { if (mutation.type !== 'childList') return; mutation.addedNodes.forEach((addedNode) => { - if (addedNode.nodeType === 3) return; + if (addedNode.nodeType !== Node.ELEMENT_NODE) return; + if (addedNode.classList?.contains('ls-block')) setDirAuto(addedNode); const subLsBlocks = addedNode.querySelectorAll(cssSelector);