Class: Following

Following(chunker, polisher, caller)

new Following(chunker, polisher, caller)

Creates an instance of Following handler.

Creates an instance of Following handler.

Parameters:
Name Type Description
chunker Object

The chunker instance.

polisher Object

The polisher instance.

caller Object

The caller instance.

Source:

Members

selectors

Stores selectors with their associated UUIDs and declarations.

Stores selectors with their associated UUIDs and declarations. Structure: { selector: [uuid, declarations] }

Source:

styleSheet

Reference to the stylesheet where new CSS rules will be inserted.

Reference to the stylesheet where new CSS rules will be inserted.

Source:

Methods

afterParsed(parsed)

Called after the entire CSS has been parsed.

Called after the entire CSS has been parsed. Starts processing stored selectors to apply attributes and insert CSS rules.

Parameters:
Name Type Description
parsed Document

The parsed document to apply the selectors on.

Source:

onRule(ruleNode, ruleItem, rulelist)

Processes a CSS rule node.

Processes a CSS rule node. Extracts rules containing adjacent sibling selectors (+) and stores them with a unique ID for later processing. Removes processed rules from the list.

Parameters:
Name Type Description
ruleNode Object

The CSS rule node.

ruleItem number

The index of the rule in the rule list.

rulelist Array

The list of CSS rules.

Source:

processSelectors(parsed, selectors)

For each stored selector, finds matching elements in the parsed document, adds a data-following attribute with the selector's UUID, and inserts corresponding CSS rules into the stylesheet.

For each stored selector, finds matching elements in the parsed document, adds a data-following attribute with the selector's UUID, and inserts corresponding CSS rules into the stylesheet.

Parameters:
Name Type Description
parsed Document

The parsed document to query elements from.

selectors Object

Map of selectors with UUID and declarations.

Source: