diff --git a/scripts/Diff.ts b/scripts/Diff.ts index 8b1c5e84..5f44483a 100644 --- a/scripts/Diff.ts +++ b/scripts/Diff.ts @@ -1,5 +1,16 @@ import MutationQueue from "./MutationQueue" +// Diff provides diffing utilities to morph existing DOM elements +// into the target HTML string. +// +// Example: +// Diff.innerHTML(body, "
This is my new content
") +// +// Whatever contents will be in the body, they will be re-used and morphed +// into the new DOM defined by a simple HTML string. This is useful for +// Single Page Applications that use server rendered pages. The server +// responds with the pre-rendered HTML and we can simply morph our current +// contents into the next page. export default class Diff { static persistentClasses = new Set() static persistentAttributes = new Set()