Constructor
new TargetCounters(chunker, polisher, caller)
Creates an instance of TargetCounters.
Creates an instance of TargetCounters.
Parameters:
Name | Type | Description |
---|---|---|
chunker |
Object | The chunker instance managing pagination. |
polisher |
Object | The polisher instance responsible for CSS injection and post-processing. |
caller |
Object | The caller or controller managing this handler. |
Extends
- Handler
Members
counterTargets :Object.<string, Object>
Stores parsed target counter definitions keyed by selector.
Stores parsed target counter definitions keyed by selector.
Type:
- Object.<string, Object>
styleSheet :CSSStyleSheet
Reference to the stylesheet where counter rules will be inserted.
Reference to the stylesheet where counter rules will be inserted.
Type:
- CSSStyleSheet
Methods
afterPageLayout(fragment, page, breakToken, chunker)
Called after page layout to update CSS rules for counters targeting elements in the pages.
Called after page layout to update CSS rules for counters targeting elements in the pages. Inserts CSS rules dynamically to reset counters on elements matching the target selectors.
Parameters:
Name | Type | Description |
---|---|---|
fragment |
DocumentFragment | The fragment of the current page. |
page |
Object | The page object (unused here). |
breakToken |
Object | The pagination break token (unused here). |
chunker |
Object | The chunker instance containing the pagesArea DOM. |
onContent(funcNode, fItem, fList, declaration, rule)
Processes CSS content function nodes to detect and handle target-counter()
functions.
Processes CSS content function nodes to detect and handle target-counter()
functions.
Replaces the function with a CSS counter variable and stores necessary metadata.
Parameters:
Name | Type | Description |
---|---|---|
funcNode |
Object | The CSS function node representing |
fItem |
Object | The current function node item (unused). |
fList |
Object | The function list (unused). |
declaration |
Object | The CSS declaration node. |
rule |
Object | The CSS rule node containing the declaration. |