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

Element can no longer be replaced after replacing it with itself #962

Closed
apaleslimghost opened this issue Jan 6, 2017 · 0 comments · Fixed by #1581
Closed

Element can no longer be replaced after replacing it with itself #962

apaleslimghost opened this issue Jan 6, 2017 · 0 comments · Fixed by #1581

Comments

@apaleslimghost
Copy link

apaleslimghost commented Jan 6, 2017

Not sure if it's actually valid to do el.replaceWith((i, el) => el), but:

const $ = cheerio.load('<a>foo</a>');

$('a').replaceWith((i, el) => el);
$('a').replaceWith('<a>bar</a>');
$.html(); //⇒ "<a>foo</a>"

It looks like el.root is no longer set after the first replaceWith.

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

Successfully merging a pull request may close this issue.

1 participant