Skip to content

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.

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