一个非常小的库,用于比较 DOM 节点
A very tiny library for diffing live DOM nodes.
Extremely handy when used in conjunction with the DOMParser API.
Diff them efficiently and only sync changes between the two nodes.
import diff from 'micromorph';
diff(fromNode, toNode);document to match a new document, maybe from a string?Micromorph is smart enough to handle full document diffing while avoiding FOUC.
import diff from 'micromorph';
const p = new DOMParser();
const newDoc = p.parseFromString(`
Hello world!
`, 'text/html');
diff(document, newDoc);With the /nav entrypoint, Micromorph automatically converts your MPA into a SPA while only re-rendering content that has changed.
import listen from 'micromorph/nav';
listen();For browsers that don't support the Navigation API, the /spa entrypoint can be used.
import listen from 'micromorph/spa';
listen();暂无开放 Issues,或尚未同步最近议题。