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

ShallowClone doesn't clone attributes #1201

Closed
iansumm opened this issue Apr 6, 2019 · 0 comments
Closed

ShallowClone doesn't clone attributes #1201

iansumm opened this issue Apr 6, 2019 · 0 comments
Labels
Milestone

Comments

@iansumm
Copy link

iansumm commented Apr 6, 2019

When you shallow clone an element you would expect that modifying the attributes of the clone would have no effect on the original element but this is not the case. shallowClone() reuses the same Attributes object from the original element. We should be cloning the Attributes instead. Try the following test.

Element element = new Element("div");
Element clone = element.shallowClone();
clone.addClass("clazz");
assertEquals("", element.className());

@jhy jhy added this to the 1.12.1 milestone May 12, 2019
@jhy jhy closed this as completed in 315655c May 12, 2019
@jhy jhy added the fixed label May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants