DEV Community

Discussion on: Building Web Components with Vanilla JavaScript

Collapse
 
smalluban profile image
Dominik Lubański

connectedCallback is called every time, when an element is attached to document, so also when you move an element from one parent to another. MDN definition:

connectedCallback: Invoked each time the custom element is appended into a document-connected element. This will happen each time the node is moved, and may happen before the element's contents have been fully parsed.

(developer.mozilla.org/en-US/docs/W...)