-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
To move the element with after (before) method. #166
Comments
If necessary, a pull request would be sent latter (sorry fixed code has not been yet written...). |
DOM elements can only have a single parent element, so jQuery gets the moving for free. Fixing this bug should be fairly easy, check for the parent reference, if it exist, remove the element from it's parent, add it to the new parent, update the reference. |
@ritalin do you mind explaining the issue your having with copying? That way we can make sure to address the problem. |
As far as I understand it, the issue isn't copying, but maintaining two references; the element isn't removed from it's old parent. |
@matthewmueller To move an element in children, now the before (after) method has used. Therefore an element in children was increased. |
@fb55 Sure, An element is not copied but had two reference. |
Hmm.. can you post some code? Including your monkey-patch that solves the issue. I feel like this would affect a bunch of other people if this was passing references. |
Avoiding to modify the codebase of cheerio, migration code is prepare for monkey-patch Following is a part of the migration code
I think that can fix more smartly... |
If I do It makes it very difficult to toggle an element. |
I'm wrong. The problem was that I was doing .append multiple times on the same element, which makes a copies. This is however still a difference from jQuery. |
This was recently fixed. |
In jQuery, a specified element is not copied but moved with after (before) method whenever the element has been already exsited in .
In Cheerio, however a specified element has been always copied.
Is this behaviour bug, or specification?
Best, regards.
The text was updated successfully, but these errors were encountered: