max-mapper / yo-yo

A tiny library for building modular UI components using DOM diffing and ES6 tagged template literals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PSA: morphdom v2 released

patrick-steele-idem opened this issue · comments

FYI, I just published morphdom@2 with some improvements:


  • Fixed #47 - Detect and handle reorder of siblings
  • onNodeAdded is now called for all on child nodes and not just the root node (closes PR #57)
  • Simplified code and reduced overall code size
  • NOTE: Performance is about the same or slightly better than the previous version of morphdom based on benchmarks
  • Added examples:./examples/

Breaking changes

  • onNodeAdded is now called for all on child nodes (not just the root node)
  • Removed deprecated options:
    • onBeforeMorphEl (use onBeforeElUpdated instead)
    • onBeforeMorphElChildren (use onBeforeElChildrenUpdated instead)

See: morphdom/CHANGELOG

When you have a chance to upgrade please let me know if you see any issues.

Cheers.

That's exciting news @patrick-steele-idem!

FYI, I tried out upgrading morphdom in yo-yo locally and it appears to have broken the following tests:

@timwis thanks for taking a look. The breaking test looks to be due to the following breaking change in morphdom:

  • Removed options:
    • onBeforeMorphEl (use onBeforeElUpdated instead)
    • onBeforeMorphElChildren (use onBeforeElChildrenUpdated instead)

Fortunately, it should be a simple change to the following line:

https://github.com/maxogden/yo-yo/blob/656992c1553782c779c9de4c711614b16c7f342a/index.js#L11

Something like the following should work:

if (opts.onBeforeMorphEl) { // If you need to support the old `onBeforeMorphEl`
  opts.onBeforeElUpdated = opts.onBeforeMorphEl
}
if (!opts.onBeforeElUpdated) opts.onBeforeElUpdated = copier
commented

We should close this issue now that #51 has landed 😸