mutation-summary icon indicating copy to clipboard operation
mutation-summary copied to clipboard

Replace NodeMap with Map or WeakMap?

Open ajvincent opened this issue 5 years ago • 0 comments

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);).

ajvincent avatar Nov 26 '20 16:11 ajvincent