Skip to content

Commit

Permalink
Improve mutation observation (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahangarha authored Jan 25, 2024
1 parent 0395baf commit ab21259
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Prevent `addedNode.querySelectorAll is not a function` error (#13)
- Improve mutation observation (#14)

## [0.2.0] - 2024-01-04

Expand Down
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,6 @@ const applyBidi = () => {
// Define the callback function
const processBlocks = (mutationsList) => {
mutationsList.forEach((mutation) => {
if (mutation.type !== 'childList') return;

mutation.addedNodes.forEach((addedNode) => {
if (addedNode.nodeType !== Node.ELEMENT_NODE) return;

Expand All @@ -286,7 +284,11 @@ const applyBidi = () => {
};

const observer = new MutationObserver(processBlocks);
observer.observe(graphDocument, { childList: true, subtree: true });
observer.observe(graphDocument, {
attributes: false,
childList: true,
subtree: true,
});
};

const applyCustomBidiStyle = () => {
Expand Down

0 comments on commit ab21259

Please sign in to comment.