Automattic/jetpack — pull request #300 by blowery (2014-03-04 16:00:02+00:00)
Title: Swap invisible DOM nodes in and out based on scrolls.

This patch teaches the infinite scroll system how to pull DOM nodes out of
nodes outside the current viewport and stash them in a cache. It does this
by hooking into determineURL and walking all of the pages that were determined
to be hidden. It pulls all of the child nodes out of the page and stashes them
in a DocumentFragment. It also updates the min-height of the page wrapper to
match the old height when all the children were present.

When a user scrolls a page back into view, the children are reinserted into
the wrapper and the min-height and class marker are removed.

All that said, I'm not sure this had much impact on the overall memory usage of the
browser. Since we're stashing the actual DOM nodes, that memory can't be saved,
but we are likely saving some render memory, as the DOM should be substantially smaller
in most cases. Need to do some more testing with a bigger, more complex set of posts.