Class: PositionFixed

PositionFixed(chunker, polisher, caller)

Handles position: fixed elements in paged media.

Since fixed positioning does not behave as expected in paged outputs, this handler collects all position: fixed elements during parsing, removes them from the flow, and re-inserts them absolutely positioned at the top of every page during layout.

Constructor

new PositionFixed(chunker, polisher, caller)

Creates an instance of PositionFixed.

Creates an instance of PositionFixed.

Parameters:
Name Type Description
chunker Object

The chunker instance used for pagination.

polisher Object

The polisher instance responsible for styles.

caller Object

The object coordinating the handlers.

Source:

Members

fixedElements :Array.<HTMLElement>

Collected DOM elements that matched fixed position rules.

Collected DOM elements that matched fixed position rules. These are inserted back on each page during layout.

Type:
  • Array.<HTMLElement>
Source:

fixedElementsSelector :Array.<string>

Array of selectors that match position: fixed elements.

Array of selectors that match position: fixed elements.

Type:
  • Array.<string>
Source:

styleSheet :CSSStyleSheet

Type:
  • CSSStyleSheet
Source:

Methods

afterPageLayout(pageElement, page, breakToken)

After each page layout, this method re-inserts all collected fixed elements into the top of the page, effectively simulating position: fixed.

After each page layout, this method re-inserts all collected fixed elements into the top of the page, effectively simulating position: fixed.

Parameters:
Name Type Description
pageElement HTMLElement

The DOM element for the current page.

page Object

Metadata or state for the current page.

breakToken Object

Information about content breaks (unused here).

Source:

afterParsed(fragment)

After parsing the full document, this method finds all elements that matched position: fixed, applies position: absolute instead, removes them from the DOM flow, and stores them for re-insertion.

After parsing the full document, this method finds all elements that matched position: fixed, applies position: absolute instead, removes them from the DOM flow, and stores them for re-insertion.

Parameters:
Name Type Description
fragment DocumentFragment

The parsed document fragment.

Source:

onDeclaration(declaration, dItem, dList, rule)

Intercepts position: fixed declarations, saves their selector, and removes the declaration from the stylesheet.

Intercepts position: fixed declarations, saves their selector, and removes the declaration from the stylesheet.

Parameters:
Name Type Description
declaration Object

The CSS AST node for the declaration.

dItem Object

The item in the declaration list.

dList Object

The full declaration list.

rule Object

The rule containing this declaration.

Source: