Class: UndisplayedFilter

UndisplayedFilter(chunker, polisher, caller)

Handler that identifies and marks elements styled with display: none from CSS or inline styles.

Constructor

new UndisplayedFilter(chunker, polisher, caller)

Creates an instance of UndisplayedFilter.

Creates an instance of UndisplayedFilter.

Parameters:
Name Type Description
chunker Object

The chunker managing document flow.

polisher Object

The polisher managing post-processing.

caller Object

The entity invoking the handler.

Source:

Extends

  • Handler

Members

displayRules :Object.<string, Object>

A map of CSS selectors to display rules (display: none, etc).

A map of CSS selectors to display rules (display: none, etc).

Type:
  • Object.<string, Object>
Source:

Methods

filter(content)

Filters out or marks elements that are not meant to be displayed.

Filters out or marks elements that are not meant to be displayed.

Parameters:
Name Type Description
content HTMLElement | DocumentFragment

The DOM content to be filtered.

Source:

onDeclaration(declaration, dItem, dList, rule)

Captures display declarations during CSS parsing.

Captures display declarations during CSS parsing.

Parameters:
Name Type Description
declaration Object

The CSS declaration node.

dItem Object

The declaration item in the AST.

dList Array

The list of declarations.

rule Object

The associated CSS rule.

Source:

removable(element) → {boolean}

Determines whether an element is removable based on its inline display style.

Determines whether an element is removable based on its inline display style.

Parameters:
Name Type Description
element HTMLElement

The element to check.

Source:
Returns:

True if the element is considered removable.

Type
boolean

sortDisplayedSelectors(content, displayRules) → {Object}

Matches display rules against elements and sorts them by specificity and importance.

Matches display rules against elements and sorts them by specificity and importance.

Parameters:
Name Type Description
content HTMLElement | DocumentFragment

The DOM content to search.

displayRules Object.<string, Object>

CSS display rules to apply.

Source:
Returns:

Matched elements and their rules.

Type
Object