Socket
Socket
Sign inDemoInstall

micromorph

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micromorph

A very tiny library for diffing live DOM nodes.


Version published
Weekly downloads
11K
decreased by-0.1%
Maintainers
1
Weekly downloads
 
Created
Source

🤏 micromorph

A very tiny library for diffing live DOM nodes.

Extremely handy when used in conjunction with the DOMParser API.


Use Cases

Want to update one node to match another?

Diff them efficiently and only sync changes between the two nodes.

import diff from 'micromorph';

diff(fromNode, toNode);
Want to update the current 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(`<h1>Hello world!</h1>`, 'text/html');

diff(document, newDoc);
Want to turn your MPA into an SPA?

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

FAQs

Package last updated on 19 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc