SkillAgentSearch skills...

Udomdiff

An essential diffing algorithm for µhtml.

Install / Use

/learn @WebReflection/Udomdiff
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<em>µ</em>domdiff

Build Status Coverage Status

a different tree

<sup>Social Media Photo by Christopher Rusev on Unsplash</sup>

An essential diffing algorithm for µhtml.

Signature

futureNodes = udomdiff(
  parentNode,           // where changes happen
  [...currentNodes],    // Array of current items/nodes
  [...futureNodes],     // Array of future items/nodes (returned)
  get(node, toDoWhat),  // a callback to retrieve the node
  before                // the anchored node to insertBefore
);

What is get and how does it work?

You can find all info from domdiff, as it's exactly the same concept:

  • get(node, 1) to retrieve the node that's being appended
  • get(node, 0) to get the node to use for an insertBefore operation
  • get(node, -0) to get the node to use for an insertAfter operation
  • get(node, -1) to retrieve the node that's being removed

If you don't care about any of those second arguments values, const get = o => o; is a valid get too.

How to import it:

  • via CDN, as global variable: https://unpkg.com/udomdiff
  • via ESM, as external module: import udomdiff from 'https://unpkg.com/udomdiff/esm/index.js'
  • via CJS: const udomdiff = require('udomdiff'); <sup><sub>( or require('udomdiff/cjs') )</sub></sup>
  • via bundlers/transpilers: import udomdiff from 'udomdiff'; <sup><sub>( or from 'udomdiff/esm' )</sub></sup>
View on GitHub
GitHub Stars161
CategoryDevelopment
Updated23d ago
Forks10

Languages

JavaScript

Security Score

95/100

Audited on Mar 5, 2026

No findings