patrick-steele-idem/morphdom

Fast and lightweight DOM diffing/patching (no virtual DOM needed)

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 42 minutes ago
Added to GitGenius on September 19th, 2026
Created on June 25th, 2015
Open Issues & Pull Requests: 67 (+0)
GitHub issues: Enabled
Number of forks: 149
Total Stargazers: 3,582 (+0)
Total Subscribers: 41 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 220.2 days
Mean response time: 521.2 days
90th percentile: 1247.3 days
Tracked items: 5

Most active contributors

Sign in to see contributor activity.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 10
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 672 days
Stale 30+ days: 9
Stale 90+ days: 9

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

morphdom is a lightweight DOM diffing and patching library that transforms an existing DOM tree to match a target DOM tree without requiring a virtual DOM.

The problem morphdom solves is preserving internal DOM state during UI updates. When a component rerenders, simply replacing the entire DOM tree with innerHTML loses scroll positions, input caret positions, CSS transition states, and other browser-maintained state. morphdom instead performs a minimal set of changes to transform the existing DOM to match the target, keeping the real DOM as the source of truth. The algorithm works in a single pass over both trees and automatically matches elements by ID when they appear in both the original and target trees.

The tool suits projects where you need efficient DOM updates while preserving user interaction state, particularly when working with templating languages that produce HTML strings. Because morphdom operates on the real DOM rather than a virtual representation, it works with any templating approach and handles manual DOM manipulations correctly. It supports both real DOM nodes and virtual DOM nodes as input, with virtual nodes automatically upgraded to real DOM nodes when needed.

The project shows consistent maintenance with regular updates addressing edge cases and browser compatibility. Development includes active bug fixes and feature additions that expand the tool's capabilities, such as the introduction of virtual DOM support. The codebase maintains backward compatibility while evolving to handle new use cases, and documentation is kept current with examples and detailed API specifications.