Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace DOMNodeInserted with MutationObserver for dynamic content handling #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JoDerGraf
Copy link

The DOMNodeInserted event is deprecated and no longer supported in recent versions of Chrome (e.g., Chrome 127 and later). This commit updates the code to use MutationObserver, which is a modern and recommended way to observe changes in the DOM.

The MutationObserver is set up to monitor changes in the document and specifically look for newly added nodes with the class collection-item. When such nodes are detected, the Redactor editor is initialized for these elements.

This change ensures compatibility with newer browser versions and improves performance and reliability when handling dynamic content.

Changes made:

  • Replaced DOMNodeInserted event listener with a MutationObserver.
  • Updated the callback function to initialize Redactor editors for dynamically added collection items.

…dling

The `DOMNodeInserted` event is deprecated and no longer supported in recent versions of Chrome (e.g., Chrome 127 and later). This commit updates the code to use `MutationObserver`, which is a modern and recommended way to observe changes in the DOM.

The MutationObserver is set up to monitor changes in the document and specifically look for newly added nodes with the class `collection-item`. When such nodes are detected, the Redactor editor is initialized for these elements.

This change ensures compatibility with newer browser versions and improves performance and reliability when handling dynamic content.

Changes made:
- Replaced `DOMNodeInserted` event listener with a `MutationObserver`.
- Updated the callback function to initialize Redactor editors for dynamically added collection items.
…-replace-dom-node-inserted

Replace DOMNodeInserted with MutationObserver for dynamic content han…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant