Class: RunningHeaders

RunningHeaders(chunker, polisher, caller)

Handles CSS Running Headers/Footers using the position: running() and content: element() CSS features.

Tracks selectors with running headers, manages their capture and placement, and applies them during page layout.

Constructor

new RunningHeaders(chunker, polisher, caller)

Creates an instance of RunningHeaders.

Creates an instance of RunningHeaders.

Parameters:
Name Type Description
chunker Object

The chunker instance controlling content chunking.

polisher Object

The polisher instance controlling polishing/styling.

caller Object

The caller or controller invoking this handler.

Source:

Extends

  • Handler

Members

elements

Stores element() CSS content references keyed by selector string.

Stores element() CSS content references keyed by selector string.

Source:

runningSelectors

Stores running header selectors keyed by the running identifier.

Stores running header selectors keyed by the running identifier.

Source:

Methods

afterPageLayout(fragment)

Called after page layout is complete.

Called after page layout is complete. Inserts cloned running header elements into their target containers.

Parameters:
Name Type Description
fragment DocumentFragment

The DOM fragment for the current page.

Source:

afterParsed(fragment)

Called after the DOM fragment is parsed.

Called after the DOM fragment is parsed. Hides running header elements by setting display: none.

Parameters:
Name Type Description
fragment DocumentFragment

The parsed DOM fragment.

Source:

beforeTreeParse(text, sheet)

Adjusts CSS text before parsing.

Adjusts CSS text before parsing.

Fixes parsing issues with element() by renaming it to element-ident().

Parameters:
Name Type Description
text string

The CSS text to parse.

sheet Object

The CSS stylesheet object.

Source:

onDeclaration(declaration, dItem, dList, rule)

Processes CSS declarations to find and store position: running() and content: element() rules.

Processes CSS declarations to find and store position: running() and content: element() rules.

Parameters:
Name Type Description
declaration Object

The CSS declaration node.

dItem Object

Declaration item (not used here).

dList Object

Declaration list (not used here).

rule Object

The CSS rule node that contains the declaration.

Source:

orderSelectors(obj) → {Array.<string>}

Orders selectors based on their page weight.

Orders selectors based on their page weight.

Does not deduplicate selectors; later selectors overwrite previous ones.

Parameters:
Name Type Description
obj Object.<string, any>

The selectors object.

Source:
Returns:

Ordered selectors array.

Type
Array.<string>

pageWeight(sopt) → {number}

Assigns a weight to @page selector classes for ordering.

Assigns a weight to @page selector classes for ordering.

Weights:

  1. page
  2. left & right
  3. blank
  4. first & nth
  5. named page
  6. named left & right
  7. named first & nth
Parameters:
Name Type Attributes Description
s string <optional>

The selector string.

Source:
Returns:

Weight value for ordering.

Type
number