Module: pipeline/elementFilter

Pipeline stage 2 — filter page elements to keep only meaningful ones.

Removes footer links, social icons, ads, hidden elements, and duplicates. Keeps forms, meaningful buttons, navigation, inputs, and interactive components.

Exports

  • filterElements — Score, deduplicate, and cap elements.
  • hasHighValueElements — Check if filtered set is worth testing.
  • filterStats — Summary string for logging.
Source:

Members

(static, constant) SHADOW_DOM_SELECTOR_PREFIX

SHADOW_DOM_SELECTOR_PREFIX — prefix used to mark elements discovered inside shadow roots so downstream code (selfHealing.js, assertionEnhancer.js) knows to use a pierce: strategy when locating them.

Source:

Methods

(static) filterElements(elements) → {Array}

filterElements(elements) → filtered elements with intent hints

Handles both regular DOM elements and elements surfaced from shadow roots (marked with _fromShadow: true by crawlBrowser.js). Shadow-root elements are scored identically but tagged so the self-healing selector waterfall can apply a pierce: strategy.

Parameters:
Name Type Description
elements Array

raw elements from DOM snapshot (may include shadow-root elements)

Source:
Returns:

filtered, deduplicated, scored elements

Type
Array

(static) filterStats()

filterStats(original, filtered) → summary string for logging

Source:

(static) hasHighValueElements()

hasHighValueElements(elements) → boolean Returns true if the filtered set contains elements worth testing

Source:

(static) isShadowElement()

isShadowElement(el) → boolean Returns true if this element was captured from inside a shadow root.

Source: