Skip to content
New issue

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

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

Already on GitHub? # to your account

When cloned, a custom element looses it's constructor class and it's custom methods #1154

Closed
Laurent-Chouinard opened this issue Sep 27, 2020 · 1 comment

Comments

@Laurent-Chouinard
Copy link

Bug report

Fiddle

https://jsfiddle.net/say37z8m/2/

Explanation

  • What is the behaviour you expect?
    I expect the clone method applied on a CustomElement to produce a CustomElement with the same constructor and same available custom methods (on the prototype) as the source element.

Should I write a custom clone method then? I don't know how to write one that works. my custom cloning introduces a problem with the tree model in the parent/children relationship

  • What is happening instead?
    the clone method returns an instance of the mother class and I loose access to my custom methods. The clone is not an instance of CustomElement anymore

  • What error message are you getting?
    When calling a custom method I get the behavior of the mother method of the same name or a TypeError "not a function" if the mother class doesn't have a method of that name.

Thank you so much for this great library.

@Fuzzyma
Copy link
Member

Fuzzyma commented Sep 27, 2020

Wow good catch! I fixed it in master :)

Also: Great fiddle!

PS: Congratulation on your first issue and welcome to GitHub!

@Fuzzyma Fuzzyma closed this as completed Sep 3, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants