From 7a52ddeba2a68388b544f529d2d92104420f77b0 Mon Sep 17 00:00:00 2001 From: Shipwreckt Date: Fri, 31 Oct 2025 20:02:14 +0000 Subject: Changed from static to 11ty! --- node_modules/morphdom/docs/old-benchmark.md | 204 ++++++++++++++++++++++++++++ node_modules/morphdom/docs/virtual-dom.md | 38 ++++++ 2 files changed, 242 insertions(+) create mode 100644 node_modules/morphdom/docs/old-benchmark.md create mode 100644 node_modules/morphdom/docs/virtual-dom.md (limited to 'node_modules/morphdom/docs') diff --git a/node_modules/morphdom/docs/old-benchmark.md b/node_modules/morphdom/docs/old-benchmark.md new file mode 100644 index 0000000..911d752 --- /dev/null +++ b/node_modules/morphdom/docs/old-benchmark.md @@ -0,0 +1,204 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
morphdom virtual-dom
change-tagname 0.01ms 0.01ms
change-tagname-ids 0.01ms 0.02ms
data-table 0.22ms 0.65ms
data-table2 0.96ms 2.00ms
id-change-tag-name 0.00ms 0.01ms
ids-nested 0.01ms 0.01ms
ids-nested-2 0.02ms 0.02ms
ids-nested-3 0.01ms 0.01ms
ids-nested-4 0.02ms 0.02ms
ids-nested-5 0.02ms 0.04ms
ids-nested-6 0.01ms 0.02ms
ids-nested-7 0.02ms 0.01ms
ids-prepend 0.02ms 0.02ms
input-element 0.01ms 0.01ms
input-element-disabled 0.01ms 0.01ms
input-element-enabled 0.01ms 0.01ms
large 1.56ms 0.98ms
lengthen 0.02ms 0.02ms
one 0.00ms 0.01ms
reverse 0.01ms 0.02ms
reverse-ids 0.03ms 0.02ms
select-element 0.04ms 0.03ms
shorten 0.02ms 0.01ms
simple 0.01ms 0.01ms
simple-ids 0.04ms 0.03ms
simple-text-el 0.01ms 0.02ms
svg 0.02ms 0.01ms
svg-append 0.04ms 0.04ms
svg-append-new 0.01ms 0.04ms
svg-no-default-namespace 0.03ms 0.02ms
svg-xlink 0.03ms 0.00ms
tag-to-text 0.00ms 0.00ms
text-to-tag 0.00ms 0.00ms
text-to-text 0.00ms 0.00ms
textarea 0.01ms 0.01ms
todomvc 0.36ms 0.25ms
two 0.01ms 0.01ms
+
+ +_NOTE: Safari Version 9.1.1 (11601.6.17)_ diff --git a/node_modules/morphdom/docs/virtual-dom.md b/node_modules/morphdom/docs/virtual-dom.md new file mode 100644 index 0000000..1232df6 --- /dev/null +++ b/node_modules/morphdom/docs/virtual-dom.md @@ -0,0 +1,38 @@ +Using `morphdom` with a virtual DOM +=================================== + +`morphdom` has always supported diffing real DOM nodes with real DOM nodes and this will continue to be supported. Support for diffing real DOM with a _virtual_ DOM was introduced in `v2.1.0`. Virtual DOM nodes are expected to implement a minimal DOM API that consists of the following methods and properties: + +- `node.firstChild` +- `node.nextSibling` +- `node.nodeType` +- `node.nodeName` +- `node.namespaceURI` +- `node.nodeValue` +- `node.attributes` +- `node.value` +- `node.selected` +- `node.disabled` +- `node.hasAttributeNS(namespaceURI, name)` +- `node.actualize(document)` [1] +- `node.isSameNode(anotherNode)` [2] + +NOTES: + +1. In addition to the standard DOM node methods and properties, a virtual DOM node must also provide a `node.actualize(document)` method. The `node.actualize(document)` will be called when the virtual DOM node needs to be upgraded to a real DOM node so that it can be moved into the real DOM. +2. A virtual DOM node may choose to implement `isSameNode(anotherNode)` to short-circuit diffing/patching a particular DOM subtree by treating two nodes as the "same" +3. A virtual DOM node may choose to implement the non-standard `assignAttributes(targetNode)` to optimize copying the attributes from the virtual DOM node to the target DOM node. If virtual DOM node implements `assignAttributes(targetNode)` then it is not necessary to implement `node.attributes`. + +[marko-vdom](https://github.com/marko-js/marko-vdom) is the first virtual DOM implementation that is compatible with `morphdom` and it can be used as a reference implementation. + +# FAQ + +## Why support a virtual DOM? + +Working with real DOM nodes is fast, but real DOM nodes do tend to have more overhead (the amount of overhead associated with real DOM nodes will vary drastically by browser). In order to be 100% compliant with the DOM specification, real DOM nodes require a lot of internal "bookkeeping" and validation checks that slow certain operations down. Virtual DOM nodes have the advantage that they can be optimized to use less memory and enable better performance since they are not required to be compatible the entire DOM specification. + +When using `morphdom` to update the view, performance will be largely dictated by how much time it takes to render the view to a virtual DOM/real DOM and how long it takes to walk the tree (including iterating over attributes). We are seeing signficant performance improvements when utilizing a virtual DOM. Please see the [marko-vdom benchmarks](https://github.com/marko-js/marko-vdom#benchmarks) to better understand the performance characteristics of the virtual DOM and the real DOM. + +## Can `morphdom` be used with any virtual DOM implementation? + +No, `morphdom` cannot be used with any virtual DOM implementation. To keep code size small and fast, morphdom requires that virtual DOM nodes implement the minimal set of methods and properties based described above. One of the goals of `morphdom` is to stay as close as possible to the real DOM while allowing for a more optimized virtual DOM when it makes sense. -- cgit v1.2.3