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

JS Error When Using on Cloned Template #259

Closed
simonferndriger opened this issue Aug 16, 2022 · 3 comments
Closed

JS Error When Using on Cloned Template #259

simonferndriger opened this issue Aug 16, 2022 · 3 comments
Assignees
Labels

Comments

@simonferndriger
Copy link

simonferndriger commented Aug 16, 2022

When using $e = $('template').contents().clone() as an element and appending it with $('body').append($e), calling $e.Lazy() afterwards triggers a JS error "Cannot call .toLowerCase() of undefined".

@dkern
Copy link
Owner

dkern commented Aug 17, 2022

Isn't a cloned element in jQuery a virtual Element? So don't you need to select the element after appending it to get the correct instance?

$e = $('template').contents().clone();
$('body').append($e);
$('clonedTemplateSelector').Lazy();

@dkern dkern self-assigned this Aug 17, 2022
@dkern dkern added the question label Aug 17, 2022
@simonferndriger
Copy link
Author

That could be, however, with jQuery I can perform all regular acitons on that virtual element, so I don't see any reason why this should not be the case here... I could save an additional select and thereby improve performance.

@dkern
Copy link
Owner

dkern commented Sep 7, 2023

I close this, more of an edge case and I will not invest into it actually.

@dkern dkern closed this as completed Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants