Skip to content

Conversation

MattiasBuelens
Copy link
Contributor

When you add a <code-input> element to the DOM after the webpage is already loaded, the element isn't set up properly. This happens because we're always adding a DOMContentLoaded listener, even when that event has already been fired before.

Similarly, when you remove a <code-input> from the DOM before it has had the chance to set up, the disconnectedCallback would throw because this.mutationObserver wasn't set yet.

@WebCoder49
Copy link
Owner

Thanks so much for this, @MattiasBuelens! I obviously didn't test enough for this specific case when simplifying the registerTemplate waiting to allow immediate setup after registering of existing elements with the template; I'll be more careful in the future.

@WebCoder49 WebCoder49 merged commit af8d152 into WebCoder49:main Aug 19, 2025
@MattiasBuelens MattiasBuelens deleted the fix-add-after-load branch August 19, 2025 14:24
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.

2 participants