treeloom
    Preparing search index...

    Function reconcile

    • Update a rendered tree to match a new version of it (the next tree, such as one inflated from a server's JSON), by changing only what differs instead of rendering everything again. Children are matched by id, otherwise by position and node name. A matched item keeps its element, its id and its listeners; it takes the next item's attributes and data, and its named listeners are made the next item's. Items the next tree doesn't have are removed, new ones are added, and then only the changed attributes and nodes are written to the page (see updateElement).

      Listeners added as functions (locally, not carried by the next tree) and focus stay where they are, since the elements do.

      Parameters

      • existing: DomItem

        An item already rendered (it has an element). It stays the same kind of node: next must be one too.

      • next: DomItem

        The tree it should now match. Its items are taken over: don't render it separately.

      Returns DomItem

      existing, updated.