Skip to content

Updating Element Registration.  #820

@pshihn

Description

@pshihn

Are there any discussions to support updating the implementation of a custom element definition? (Searched and did not spot anything obvious)

Something like this:

customElements.define('my-element', MyElement);
// ...
// some time later...
customElements.redefine('my-element', MyElement2);

I can see a lot of issues with this, the obvious one being what happens to existing elements that are already in the DOM - are they recreated? left alone with old implementation? Or just turned into no-ops?

Use case

Let's say, I have a web component that is sitting on a page with long life time .- say email client or stock dashboard which people have open all the time and rarely 'refresh'.

The client code at some point realized there's a new version of my-element available and I want to upgrade it to the latest without reloading the whole page.

This is particularly useful if there's some sort of change in the protocol/api the custom element may use with the back end.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions