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

.html($('selector')) copies the node instead move it #940

Closed
oscarotero opened this issue Nov 18, 2016 · 0 comments · Fixed by #1923 · 4 remaining pull requests
Closed

.html($('selector')) copies the node instead move it #940

oscarotero opened this issue Nov 18, 2016 · 0 comments · Fixed by #1923 · 4 remaining pull requests

Comments

@oscarotero
Copy link

Hi.
In jquery this code moves a node inside other:

$element = $('.element');
$container = $('.container');
$container.html($element);

But in cheerio, this generates a new element, so I get two: the outside and the inside of container. A way to fix this is using appendTo:

$element.appendTo($container);

But I guess html should be fixed. Thanks.

fb55 added a commit that referenced this issue Jun 8, 2021
@fb55 fb55 closed this as completed in #1923 Jun 8, 2021
fb55 added a commit that referenced this issue Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment