cache-element
Cache an HTML element that's used in DOM diffing algorithms that respect
element.isSameNode()
.
Usage
var cache = var html = var nav = documentbody
API
element = cache(render)
Create a new instance of cache-element. Takes a render function that is called
when element.render()
is called and a prior call doesn't have a node mounted
on the DOM.
element.render()
Render the element to append it on the DOM. As long as the Node is on the DOM,
subsequent calls to element.render()
will return an empty node that has a
.isSameNode()
method on it so diffing algorithms that respect this property
will skip diffing this node.
Installation
$ npm install cache-element