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

Replace NodeMap with Map or WeakMap? #44

Open
ajvincent opened this issue Nov 26, 2020 · 0 comments
Open

Replace NodeMap with Map or WeakMap? #44

ajvincent opened this issue Nov 26, 2020 · 0 comments

Comments

@ajvincent
Copy link

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap

https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

The Map and WeakMap primordial has been part of ECMAScript (and thus JavaScript) for many years now. I'm reasonably certain that, among the browsers listed on the MutationObserver page, most have reached end-of-life for the versions that don't support Map or WeakMap a long time ago.

WeakMap would be preferable. The only place NodeMap.prototype.keys is used is line 670 of the current code (change.maybeMoved.keys().forEach(isMoved);).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant