Class: Layout

Layout()

Layout

Constructor

new Layout()

Source:

Methods

addOverflowNodes(dest, source) → {void}

Merge items from source into dest which don't yet exist in dest.

Merge items from source into dest which don't yet exist in dest.

Parameters:
Name Type Description
dest element

A destination DOM node tree.

source element

A source DOM node tree.

Source:
Returns:
Type
void

addOverflowToPage(dest, breakToken, alreadyRendered) → {void}

Add overflow to new page.

Add overflow to new page.

Parameters:
Name Type Description
dest element

The page content being built.

breakToken breakToken

The current break cotent.

alreadyRendered element

The content that has already been rendered.

Source:
Returns:
Type
void

addTemporarySplit(DomElement)

Adds temporary data-split-to/from attribute where needed.

Adds temporary data-split-to/from attribute where needed.

Parameters:
Name Type Description
DomElement

element The deepest child, from which to start.

Source:

append(node, dest, source, breakToken, shallow, rebuild) → {ChildNode}

Add text to new page.

Add text to new page.

Parameters:
Name Type Default Description
node element

The node being appended to the destination.

dest element

The destination to which content is being added.

source element

The source DOM

breakToken breakToken

The current breakToken.

shallow bool true

Whether to do a shallow copy of the node.

rebuild bool true

Whether to rebuild parents.

Source:
Returns:

The cloned node.

Type
ChildNode

deleteTemporarySplit(DomElement, boolean)

Removes temporary data-split-to/from attribute where added.

Removes temporary data-split-to/from attribute where added.

Parameters:
Name Type Description
DomElement

element The deepest child, from which to start.

boolean

isTo Whether a split-to or -from was added.

Source:

firstOverflowingChild(node, bounds) → {ChildNode|null|undefined}

Returns the first child that overflows the bounds.

Returns the first child that overflows the bounds.

There may be no children that overflow (the height might be extended by a sibling). In this case, this function returns NULL.

Parameters:
Name Type Description
node node

The parent node of the children we are searching.

bounds array

The bounds of the page area.

Source:
Returns:

The first overflowing child within the node.

Type
ChildNode | null | undefined

getAncestorPaddingBorderAndMarginSums()

Sums padding, borders and margins for bottom/right of parent elements.

Sums padding, borders and margins for bottom/right of parent elements.

Assumes no margin collapsing because we're considering overflow on a page.

This and callers need to be extended to handle right-to-left text and flow but I'll get LTR going first in the hope that it will simplify the task of getting RTL sorted later. Need test cases too.

Source:

getAncestorTheadSizes()

Checks whether an element is within a table and gets any THEAD sizes.

Checks whether an element is within a table and gets any THEAD sizes.

Source:

hasOverflow(element, bounds) → {bool}

Does the element exceed the bounds?

.

Does the element exceed the bounds?

Parameters:
Name Type Description
element element

The element being constrained.

bounds array

The bounding element.

Source:
Returns:

Whether the element is within bounds.

Type
bool