-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Data: remove user data in cleanData #2480
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
Conversation
|
This is an observable difference, though, so we might want to document it anyway. |
|
Was there a reason to remove private data but not user data? It isn't necessary for any memory/GC issues (unless someone is keeping removed elements around) but I think if (I just updated the tests to also do a |
I can't think of one. It does seem odd that we're doing one but not the other. |
One potential reason is that user data never leaks and event handlers may register event data on other elements (like in the focusin case) so it has to be cleaned to not leak. That said, we might want to clean user data as well for consistency with older versions. I don't have a strong opinion here. |
|
We definitely need to call the teardowns for special events, which we are doing, but I think that should still work even if we don't |
That's true but if you then re-attached the element to the DOM, effects could be... interesting. ;) |
|
We're always in the process of letting elements go when they get to this point, but yeah if you pull them out of the trash who knows if you can still eat them or not? 😸 |
|
Originally d702b76 stopped clearing both user and private data and only cleared events. Not clearing private data caused #2127 so clearing private data was added back but user data was not. What if something/someone depends on user data similar to the tests depending on private data? IMO just the consistency with 1.x/2.x/compat and avoiding doc changes is worth the extra code though. |
|
Thanks @jbedard for finding all that info with links! The initial idea was that cc @rwaldron |
|
@jbedard Could you create an issue and then reference it in the commit message as "Fixes gh-ISSUE_NUMBER"? We try to separate issues & PRs. Otherwise, this LGTM. |
|
👍 |
test/unit/manipulation.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"return" :)
|
Created #2503 and updated the commit message, and fixed the typos. |
The tests needed a slight change as on compat we're not removing the value for expando but setting it to undefined. Refs gh-2480
Shouldn't user data be removed like v1 and v2? Or was that change intentional?
Note that this needs to change if/when #2479 is merged.