Skip to content

Replace deprecated DOMNodeInserted with MutationObserver - #24

Merged
monim67 merged 1 commit into
masterfrom
fix-21
Sep 5, 2026
Merged

Replace deprecated DOMNodeInserted with MutationObserver#24
monim67 merged 1 commit into
masterfrom
fix-21

Conversation

@monim67

@monim67 monim67 commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Purpose

The DOMNodeInserted mutation event is deprecated and already unsupported in some browsers (#21), which also prevents flatpickr inputs inserted dynamically (e.g. inside a modal) from being initialized (#16).

Approach

Replaced the DOMNodeInserted listener with a standard MutationObserver, observing the whole document with subtree: true so nested insertions (e.g. modal content added inside an existing wrapper, not directly under <body>) are also detected.

Issues solved in this PR

What has Changed

  • django-flatpickr.js

Fixes #21
Fixes #16

Observes the whole document with subtree:true so dynamically inserted
flatpickr inputs (e.g. inside modals) are detected regardless of nesting.

Fixes #21
Fixes #16
@monim67
monim67 merged commit 2f6dda6 into master Sep 5, 2026
13 checks passed
@monim67
monim67 deleted the fix-21 branch September 5, 2026 18:16
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.

[Deprecation] Listener added for a 'DOMNodeInserted' mutation event. Does not works in Bootstrap modal

1 participant