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

Fix .add #1656

Merged
merged 3 commits into from
Jan 9, 2021
Merged

Fix .add #1656

merged 3 commits into from
Jan 9, 2021

Conversation

5saviahv
Copy link
Contributor

@5saviahv 5saviahv commented Jan 6, 2021

if other is cheerio object, _make will return it as unchanged. So if add changes something there it also affects original other object.

Should fix #834

@5saviahv 5saviahv added the javascript Pull requests that update Javascript code label Jan 6, 2021
@fb55 fb55 mentioned this pull request Jan 9, 2021
@fb55 fb55 merged commit 9f9b493 into cheeriojs:main Jan 9, 2021
@fb55
Copy link
Member

fb55 commented Jan 9, 2021

Nice one! I am a bit surprised that this wasn't implemented this way before, as prevObject wasn't updated before.

Also, we should rename _make to pushStack, to match jQuery — I've opened #1665 to track.

@5saviahv 5saviahv deleted the fix-add branch January 9, 2021 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code
Development

Successfully merging this pull request may close these issues.

Weird add() behavior modifies the selection when changing child attributes
2 participants