Skip to content

Replace NodeMap with Map or WeakMap? #44

Description

@ajvincent

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions