Skip to content

Implement disconnectedCallback() and disconnect() lifecycle cleanup for custom elements #163

@piraz

Description

@piraz

Implement the disconnectedCallback() lifecycle method for custom elements to handle cleanup when the component is removed from the DOM. This method must:

  • Check if the component is still considered 'connected' (using a custom connected() method).
  • If connected, remove the comment element from its parent if it exists.
  • Call a custom disconnect() method for further cleanup (such as removing listeners, freeing resources, etc.).

Also, implement the disconnect() method as a placeholder for custom cleanup logic. It should be empty by default but documented for extension.

This ensures proper cleanup and extensibility for custom elements in the codebase.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions