Constructor
new WhiteSpaceFilter(chunker, polisher, caller)
Create a WhiteSpaceFilter instance.
Create a WhiteSpaceFilter instance.
Parameters:
Name | Type | Description |
---|---|---|
chunker |
Object | Handles document chunking. |
polisher |
Object | Handles CSS polishing/styling. |
caller |
Object | The invoking processor or engine. |
- Source:
Extends
- Handler
Methods
filter(content)
Filters out or normalizes ignorable whitespace-only text nodes from content.
Filters out or normalizes ignorable whitespace-only text nodes from content.
Parameters:
Name | Type | Description |
---|---|---|
content |
DocumentFragment | HTMLElement | The DOM content to filter. |
- Source:
filterEmpty(node) → {number}
Determines whether a text node should be removed or normalized.
Determines whether a text node should be removed or normalized. Replaces content with a single space if it's between significant siblings, and removes the node if it's safe to do so.
Parameters:
Name | Type | Description |
---|---|---|
node |
Text | The text node to evaluate. |
- Source:
Returns:
A NodeFilter constant indicating filter behavior.
- Type
- number