Class: RangeBinding

lib/core/renderer/program/blocks.RangeBinding(anchor, createInstance, blocks, locals, onBlockMountedopt)

The state one range op keeps between evaluations.

Held on the binding rather than in a map keyed by op, so it is released with the instance and cannot outlive the DOM it refers to.

Constructor

new RangeBinding(anchor, createInstance, blocks, locals, onBlockMountedopt)

Parameters:
Name Type Attributes Default Description
anchor Text

The text node the compiler reserved for this op.

createInstance function

Builds a template instance for a block.

blocks Array:.<object:>

The program's block table.

locals object | null

The enclosing block's local bindings.

onBlockMounted function <optional>
null

Announces a mounted block.

Source:

Members

onBlockMounted :function

Called after a block's nodes enter the document.

A block can contain a child-component mount point, and the pass that instantiates those scans the subtree -- so it has to be told that the subtree grew. Without this a component inside <@for>, <@if> or <@defer> renders its placeholder and never mounts, which is exactly the defect the E2E suite pinned for <@defer>.

Type:
  • function
Source:

parent

The node new content is inserted into.

Source:

Methods

createRange(index, extra) → {BlockRange|null}

Builds a range for one block index.

Parameters:
Name Type Default Description
index number

The block index.

extra object | null null

Local bindings this block adds.

Source:
Returns:

The range, or null when the index is absent.

Type
BlockRange | null

mountRange(range, parent, after) → {Node}

Mounts a range and announces it.

Parameters:
Name Type Description
range BlockRange

The range to mount.

parent Node

The parent node.

after Node

The node to insert after.

Source:
Returns:

The last node inserted.

Type
Node