Show:

Handles creating, allocating and removing DOM elements within a provided DOM element. Manages a pool of nodes based on DOM tagName for DOM node reuse. When a Surface is deallocated, its element is cleared and put back in the pool. When a Surface is allocated, an existing cleared element of the same tagName is looked for. If it is not found, a new DOM element is created.

Constructor

Core.DOMAllocator

(
  • container
)
private

Parameters:

  • container Node

    DOM element

Item Index

Methods

allocate

(
  • type
)
Node

Allocate an element of specified type from the pool.

Parameters:

  • type String

    DOM tagName, e.g., "div"

Returns:

Node:

deallocate

(
  • element
)

De-allocate an element of specified type to the pool for recycling.

Parameters:

  • element Node

    DOM element

migrate

(
  • container
)

Move the DOM elements from their original container to a new one.

Parameters:

  • container Node

    DOM element

set

(
  • container
)

Set containing element to insert allocated content into

Parameters:

  • container Node

    DOM element