mutate() original state / source restoration improvements

  • Should restoration only work on remember (name pending, maybe recall) class/attrib elements?

WeakMap (node as key)

  • Removes need for ID, uses node itself as key
  • 👍 Allows for garbage collection
  • Enforces 1:1 original source ID
  • DOM.reset less performant (have to WeakMap.get all potential elements)

Data attribute + array

  • 👍 Super fast reset via querySelectorAll('[data-osid]') reference
  • Allows for 'duplication' of OS content by copying OSID references
  • No cleanup if element is permanently removed
  • Dirtys DOM (see #103)

DOM node property + array

  • 👍 Does not dirty visible DOM
  • Chance of prop collision (but low due to pd_ naming convention)

Misc

  • Rename OSID if appropriate.
    • renamed to originalState
  • Rename to initialStateif we don't allow replacement of original?
Edited by Lorin Halpert