new Breaks(chunker, polisher, caller)
Handles CSS break properties for paged media.
Handles CSS break properties for paged media.
Parameters:
Name | Type | Description |
---|---|---|
chunker |
Object | The chunker instance managing the pagination. |
polisher |
Object | The polisher instance managing CSS and styles. |
caller |
Object | The caller instance (optional, context info). |
- Source:
Members
breaks :Object.<string, Array.<Object>>
Stores break rules keyed by CSS selector.
Stores break rules keyed by CSS selector.
Type:
- Object.<string, Array.<Object>>
- Source:
Methods
addBreakAttributes(pageElement, page)
Adds break-related data attributes from elements on the page to the page object.
Adds break-related data attributes from elements on the page to the page object.
Parameters:
Name | Type | Description |
---|---|---|
pageElement |
Element | The page DOM element. |
page |
Object | The page metadata object to update. |
- Source:
afterPageLayout(pageElement, page)
Hook called after a page layout is finished.
Hook called after a page layout is finished. Adds break-related data attributes from page elements to the page metadata.
Parameters:
Name | Type | Description |
---|---|---|
pageElement |
Element | The page DOM element. |
page |
Object | The page metadata object. |
- Source:
afterParsed(parsed)
Called after CSS is parsed.
Called after CSS is parsed. Applies break rules to elements in the parsed document.
Parameters:
Name | Type | Description |
---|---|---|
parsed |
DocumentFragment | The parsed DOM fragment. |
- Source:
mergeBreaks(pageBreaks, newBreaks) → {Object.<string, Array.<Object>>}
Merges new break rules into existing break rules.
Merges new break rules into existing break rules.
Parameters:
Name | Type | Description |
---|---|---|
pageBreaks |
Object.<string, Array.<Object>> | Existing break rules. |
newBreaks |
Object.<string, Array.<Object>> | New break rules to merge. |
- Source:
Returns:
The merged break rules.
- Type
- Object.<string, Array.<Object>>
onDeclaration(declaration, dItem, dList, rule)
Processes a CSS declaration related to breaks.
Processes a CSS declaration related to breaks. Extracts break properties and stores them by selector. Removes the declaration from the CSS to avoid duplication.
Parameters:
Name | Type | Description |
---|---|---|
declaration |
Object | The CSS declaration node. |
dItem |
Object | The item in the declaration list. |
dList |
Object | The list of declarations. |
rule |
Object | The CSS rule node containing the declaration. |
- Source:
processBreaks(parsed, breaks)
Applies stored break rules to matching elements.
Applies stored break rules to matching elements.
Parameters:
Name | Type | Description |
---|---|---|
parsed |
DocumentFragment | The parsed DOM fragment. |
breaks |
Object.<string, Array.<Object>> | Break rules keyed by selectors. |
- Source: