Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further upgrade of custom elements #620

Closed
thepian opened this issue Dec 29, 2016 · 2 comments
Closed

Further upgrade of custom elements #620

thepian opened this issue Dec 29, 2016 · 2 comments

Comments

@thepian
Copy link

thepian commented Dec 29, 2016

I have a particular use case that made me wonder if there should be a method for upgrading a single element to a custom class. Like define, but for a specific element, so customElements.upgrade(el,class). I know that WebKit doesn't want to support upgrading builtin elements, but I'm thinking about custom elements.

The use case is the use of custom elements in <template>s where the rendered custom element relies on a link to the source custom element within the template. The element in the template provides extra functionality.

I suppose this can be done simply by changing the constructor or __proto__ of the element, but I'm unaware if that is supported on all browsers. In that case I guess this is not worth adding to the API.

@annevk
Copy link
Collaborator

annevk commented Sep 6, 2017

All browsers support __proto__. It's not a great way to write code though I believe.

@annevk annevk closed this as completed Sep 6, 2017
@rniwa
Copy link
Collaborator

rniwa commented Sep 6, 2017

It's standardized in ECMA2015+. You can also use the newly added Object.setPrototypeOf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants