Rich text / foldkit-richtext-dom
adopt
function · packages/richtext-dom/src/index.ts:232
function adopt(
existing: Element,
content: RichText.Document,
rendering?: RichText.Rendering,
decorations?: RichText.DecorationSet,
): EditorDom | undefinedTakes over a subtree already in the page when it is exactly what mount would build, such
as server markup the browser parsed (§145): the elements stay, and the identity index is
built around them. Undefined when anything differs, so the caller builds afresh.
Markup cannot carry an empty text node, and a caret in an empty run needs one, so an empty
run's content is replaced by what mount gives it; the run's element stays.